Shell Script problem $( vs ticks [`]

ok so, I recently started using

$(echo one two three)

to execute commands in scripts instead of using

`echo one two three`

.

This method works wonderfully on ubuntu. However, it doesn't seem to work on other unix systems, i.e redhat/sun sun solaris.

I really hate to go back to the ticks "`" so i'm wondering if anyone here knows of a way around this.

when i run a script containing GECKO=$(echo one two three) on a non-ubuntu box, i get some type of error similar to :

: syntax error at line 175: `MONTH=$' unexpected

i have tried using different shells - bash, ksh, sh - same thing.

Any suggestions?

On Solaris /bin/sh for some strange reason still points to an actual real Bourne Shell instead of a POSIX shell. Try to using a POSIX shell by putting

#!/usr/xpg4/bin/sh

as the first line of your script (I believe it is pointing to a ksh), or use ksh93 that possibly is available on your system.

That is strange. The first two should understand $( ).

Thank you so much. your suggestion worked :slight_smile: