[Techtalk] BASH command subsitution
David Sumbler
david at aeolia.co.uk
Sun Sep 7 09:56:55 EST 2003
On Sun, 7 Sep 2003, Robin Hood wrote:
> I have been working through my Unix textbook and am up to the chapter on the
> Bourne shell.
> I am up to the section on command subsitution.
> According to my textbook typing:
>
> $ echo the date today is 'date'
>
> should result in something like:
>
> the date today is Mon Feb 2 00:41:55 CST 1998
(etc.)
You need to be using "back-quotes" (i.e. ` ) rather than
forward-quotes ( ' ).
The recommended way of doing command substitution is (e.g.):
$ echo $(date)
rather than
$ echo `date`
This first way is preferable for readability and clarity.
David
--
More information about the Techtalk
mailing list