Shell script
Scott Lanning
slanning at buphy.bu.edu
Tue Jun 13 16:31:19 EDT 2000
On Tue, 13 Jun 2000, Anthony J. Gabrielson wrote:
> I have what I hope to be an easy question. How do I make the
>output of a command, it will be a number, assign to a variable. I'm using
>bash - I have been reading through several books on this and I'm starting
>to get frusterated.
$ set var=`echo 3284`; echo $var
or
$ export var=`echo 3284`
$ echo $var
The first way is okay if you're in a script rather than
the command-line, as the variable will be in scope throughout
the rest of the file (but not outside it). 'export' makes
the variable global.
'man bash' is one of the best manpages in my opinion;
read the whole thing and be happy later.
-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).
More information about the Discuss
mailing list