Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Bash / Shell Scripting (http://www.programmingforums.org/forum26.html)
-   -   Making a variable sub-shell accessible? (http://www.programmingforums.org/showthread.php?t=13095)

Emperor May 2nd, 2007 2:29 AM

Making a variable sub-shell accessible?
 
Hey guys, how do you make a variable accessible to a subshell? Also, do you use for OR aka || in a pathname? Is it ||? Thanks for any help.

jim mcnamara May 4th, 2007 11:24 AM

:

#Bourne shell
VARIABLE="something"
export VARIABLE
#ksh, zsh, bash
export VARIABLE="something"

OR in a pathname? Do you mean this
:

if [[ -d /path/one || -d /path/two ]] ; then
  echo "At least one of these two is a valid path"
fi


Fourth Jun 27th, 2007 7:39 PM

if you wanna specify OR in a conditional its -o i believe. i.e

:

if [ -d /path/one -o -d /path/two ] ; then
  echo "At least one of these two is a valid path"
fi


assuming thats what you are asking.


All times are GMT -5. The time now is 9:28 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC