[Techtalk] BASH command subsitution
Conor Daly
conor.daly at oceanfree.net
Sun Sep 7 12:51:41 EST 2003
On Sun, Sep 07, 2003 at 06:14:48PM +1000 or so it is rumoured hereabouts,
Jacinta Richardson thought:
>
> (In bash apostrophes are just quoting characters. Backticks say, evaluate
> this first and then I'll work with the result.)
And for those of us (like me) who can never remember how the different
qoutes work:
No quotes: any variables or evaluated.
$ echo $HOME
/home/cdaly
Single quotes: variables are not evaluated.
$ echo '$HOME'
$HOME
Double quotes: variables are evaluated.
$ echo "$HOME"
/home/cdaly
Backticks: variables are evaluated and their expanded result is run
as a command.
$ echo `$HOME`
bash: /home/cdaly: is a directory
There's more to it than just that but I can't remember what. I seem to
recall a website called something like "Advanced bash programming" that
talks about such stuff. Might be worth a google...
Conor
--
Conor Daly <conor.daly at oceanfree.net>
Domestic Sysadmin :-)
---------------------
Faenor.cod.ie
12:48pm up 20 days, 19:21, 0 users, load average: 0.00, 0.00, 0.00
Hobbiton.cod.ie
12:46pm up 20 days, 19:20, 1 user, load average: 0.08, 0.04, 0.01
More information about the Techtalk
mailing list