------------------------------------------------
On Wed, 12 Feb 2003 13:08:41 -0600, Chris Ward <[EMAIL PROTECTED]> 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
> 
> 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?
> 

This has been asked before and I am not sure a good answer was ever found. Just a 
couple of thoughts, exporting the variable in one 'system' call and then doing another 
'system' call does the system calls in two different instances of the shell (which may 
or may not be bash) in which case it is not visible from one "session" to the next.  
'source' is a builtin in the shell, and may or may not be available in the shell that 
'system' uses, for instance Perl I believe will default to /bin/sh which may or may 
not be bash on your particular OS, or even on your particular instance of that OS (say 
if you setup a symbolic link from /bin/sh to /usr/local/bin/bash, though don't do that 
unless you know what you are doing) and may or may not implement 'source'.

So where does that leave you?  I suppose trying something like this (which I suggested 
before but never heard back on):

system('export CVSROOT=/path/to/cvsroot; /bin/othercommands');

However if you want to just have a script that sets these types of things, you are 
probably better left at using plain old shell script rather than using the overhead of 
Perl to do non-Perl stuff.

Make sense anyone?

http://danconia.org

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

Reply via email to