Chris Ward wrote:
> Very simple i would think, like "system('export
> CVSROOT=/path/to/repository')" Or so i would I guess; what i just
> wrote does not work for me.
> 
> I'm needing this for a CVS repository selection script. Does this
> make sense? All of the repositories are on a single server. Here's my
> logic. 
> 
> # Open the CVS root directory (Where all the repositories will be
> stored under) and show a menu to the user of all repositories
> available. # Give user a choice of each directory (repository) to
> select as their own CVSROOT
> # Export that path to bash environmental variable CVSROOT

I'm not a CVS expert, but I don't think CVSROOT works that way.

> 
> Cool? Probably not, but i'd still like to know how to export a
> variable in bash through perl. I've tried a few things like creating
> a bash script *.sh and the sourcing it through system('source
> whatever.sh'), but it always claims that source isn't a correct
> command. Cool? 

"source" is a csh thing. For Bourne-type shells you use a dot:

   . whatever.sh

There's really no way to set the environment of the parent process from the
child. You can do something cutesy like the following:

   File: menu
   ----------
   perl menu.pl && . /tmp/menu.out


   File: menu.pl
   -------------
   #!/usr/bin/perl

   ...code to figure out cvs root...

   open TEMP ">/tmp/menu.out" or die $!
   print TEMP "CVSROOT=$cvsroot; export CVSROOT\n";
   close TEMP

Now you can call your menu as:

   . menu

If you don't use the dot it won't work. You could use an alias.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to