[TriLUG] bash cmd line processing question

Mike McLean mamclean at eos.ncsu.edu
Thu Feb 14 16:55:14 EST 2002


Jonathan Rippy wrote:
> Without bothering to look this up, I've got a question.
> 
> Is this only a bash-ishm at this point?  Have the other shells
> migrated to this form?  For instance I know tcsh,csh and Perl
> understand the backtick form (among many others probably).

Just a quick login to a solaris box.... and I get
~> tcsh
~> echo $(echo hi)
Illegal variable name.
~> sh
$ echo $(echo hi)
syntax error: `(' unexpected
$ ksh
$ echo $(echo hi)
hi
$ bash
bash-2.05$ echo $(echo hi)
hi

So it appears the only bash and ksh support this syntax.  However,
writing scripts to be portable over INTERPRETERS is a shaky prospect at
best (although I hear that bash and ksh are supposed to be very
compatible).

Also, you should never use the c-shell to write scripts.
http://www.perl.com/pub/a/language/versus/csh.html



More information about the TriLUG mailing list