[Techtalk] re: Joining commands together in bash

Meredydd meredydd at everybuddy.com
Mon May 12 12:33:18 EST 2003

On Monday 12 May 2003 11:25, Berenice wrote:
> Do newer versions of bash accept statements in the form of
> x`blahblah` != x  ?  I know you've said it works in older shells, but
> it doesn't seem to work in mine.
Hmm, that's odd. In what way doesn't it work? Did you copy my command 
fragments verbatim?

> I don't know if I'm typing it wrong,
> but I also tried `echo hi` at the command prompt and got the message
> "bash: hi: command not found".  Just wondering...

Hrm. Well, the `echo hi` thing is a natural extension of the substitution 
thing. If I type:

bash-2.05b$ `echo hi`

That `` gets substituted before the command is interpreted. So when it gets 
around to looking for a command to execute, it sees:

bash-2.05b$ hi

...and so gives you "hi: command not found". Try executing "echo `echo hi`", 
which will just translate to "echo hi".


More information about the Techtalk mailing list