I am execution following .sh file in solaris box its not working but if i execute as command line, its working
bash-3.00$ ksh test.sh
ksh test.sh
test.sh[3]: syntax error at line 3 : `(' unexpected
test.sh is (not working)
#!/bin/ksh
x1=`grep -i "\abc" /UC/*.*`
x=($(echo $x1 | cut -f3 -d" " | cut -f1 -d"]"))
Manual Execution: (working fine)
bash-3.00$ x=($(echo $x1 | cut -f3 -d" " | cut -f1 -d"]"))
x=($(echo $x1 | cut -f3 -d" " | cut -f1 -d"]"))
echo $x1 | cut -f3 -d" " | cut -f1 -d"]"
bash-3.00$ echo ${x[0]}
echo ${x[0]}
GOOD Boy
bash-3.00$
Solaris Verison:
GNU bash, version 3.00.16(1)-release (sparc-sun-solaris2.10)
bash test.shx1is? Guessing quoting"$(echo $x1 | cut -f3 -d" " | cut -f1 -d"]")"might help. Also, you should put ksh as a tag rather than powershell(or other character, which is going to be specific to whateverx1actually is. So would help if you echoed it.