Hi guys,

I have a shell script which is to run on multiple OS, I have the following two variables declared:

NPAID_CMD="ps -A -o pid,comm | grep NParchiveSM | awk -F \" " '{print $1}'\"
 SHMMAX="echo "Not impletemted on $OS""

On Linux the above decelerations are fine and work as expected however on Solaris and AIX the following error is given:

./new_npa_sysinfo.sh: line 64: impletemted: command not found
./new_npa_sysinfo.sh: line 65:  '{print }': command not found

The script uses bash and I know it is due to the different version on the different operating systems, but it isnt an option to upgrade bash.

SHMMAX='echo "Not implemented on $OS"'

But it is better not to put commands and their arguments into variables.

If you need to encapsulate a command, use a function instead:

shmmax()
{
  echo "Not implemented on $OS"
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.