[clug] Amusing little /bin/sh question..
Peter Barker
pbarker at barker.dropbear.id.au
Wed May 23 07:06:20 GMT 2007
On Wed, 23 May 2007, Andrew Janke wrote:
> How can I get what the value of somevar in another script, for example
Would it be possible to just "source" the first script from the second?
e.g.
--------
pbarker at apiomerus:~/test2$ cat > a.sh
#!/bin/sh
somevar="a-value"
pbarker at apiomerus:~/test2$ cat > b.sh
#!/bin/sh
source a.sh
echo "somevar=$somevar";
pbarker at apiomerus:~/test2$ chmod +x b.sh
pbarker at apiomerus:~/test2$ ./b.sh
somevar=a-value
pbarker at apiomerus:~/test2$
-------
> a
> Andrew Janke (a.janke at gmail.com || http://a.janke.googlepages.com/)
Yours,
--
Peter Barker | N _--_|\ /---- Barham, Vic
Programmer,Sysadmin,Geek | W + E / /\
pbarker at barker.dropbear.id.au | S \_,--?_*<-- Canberra
You need a bigger hammer. | v [35S, 149E]
"Peter is apathetic, and I'm vaguely apathetic" -- Rachel, thinking of organising a movie trip
More information about the linux
mailing list