Operating System - HP-UX
1752639 Members
5715 Online
108788 Solutions
New Discussion юеВ

Does HPUX 11.11 support "(command)" as the subshell?

 
SOLVED
Go to solution
jh_yang
Advisor

Does HPUX 11.11 support "(command)" as the subshell?

It seems only `command` as the command substitution works, not (command). Any idea?
4 REPLIES 4
Bill Hassell
Honored Contributor
Solution

Re: Does HPUX 11.11 support "(command)" as the subshell?

The proper form is: $(command) as in:

ABC=$(date)

The use of grave accents characters such as `command` is deprecated.


Bill Hassell, sysadmin
Laurent Menase
Honored Contributor

Re: Does HPUX 11.11 support "(command)" as the subshell?

for command substitution you must use $(command)
for subshell you can use (command)

for instance

( echo hello; sleep 1; echo bye) | cat
it is a subshell

a=$(ps)
echo $a
is command substitution.

James R. Ferguson
Acclaimed Contributor

Re: Does HPUX 11.11 support "(command)" as the subshell?

Hi:

I think you mean something like:

# LIST=$(cat ${MYFILE})

...or the archaic form using backticks:

# LIST=`cat ${MYFILE}`

...all of which can be made faster by doing:

# LIST=$(< ${MYFILE})

Regards!

...JRF...
jh_yang
Advisor

Re: Does HPUX 11.11 support "(command)" as the subshell?

Thanks. That's the answer I am looking for.