Q:

Assigning "awk" or "nawk" to a variable in a shell script

I have a script to be run on both Solaris and Red Hat systems. I want to use "nawk" in Solaris and "awk" in Red Hat systems as text processing tool. For that, I have a code snippet as below in my script:
...
if [ "$SYSTEM_OS" = "SunOS" ]; then
cibi_seperator="nawk"
elif [ "$SYSTEM_OS" = "Linux"  ]; then
cibi_seperator="awk"
fi
...

When I run the script, I get following errors:
    bash-3.00$ ./cibi_awk_both_os.sh 
./cibi_awk_both_os.sh: line 75: -F,: command not found
./cibi_awk_both_os.sh: line 77: -F: command not found
./cibi_awk_both_os.sh: line 77: -F=: command not found
./cibi_awk_both_os.sh: line 77: -v: command not found
./cibi_awk_both_os.sh: line 79: -F,: command not found
./cibi_awk_both_os.sh: line 85: -F,: command not found
./cibi_awk_both_os.sh: line 107: -F,: command not found
./cibi_awk_both_os.sh: line 108: -F,: command not found

75th line of the script:
$cibi_seperator -F, 'NR==1,NR==2{print $0;}' cibi.csv > section_header.csv

All the other problematic lines (77, 79, 85, 107, 108) use also the variable $cibi_seperator.
How to use this variable correctly in my script?
Thanks,
Murat

A:

Found out the problem:
I set the parameter:
SYSTEM_OS=`uname -a`

before the if statement. Whereas, I should have set it to:
SYSTEM_OS=`uname -s`

Sorry for the inconvenience.

