Trouble storing a variable in a shell script after awk output

view full story

http://www.linuxquestions.org – Hi folks, On command line I have no problem storing a variable e.g Code: :~/bin$ process=`ps -ef | awk ' $8 == "idesk" { print $2 }'` :~/bin$ echo $process 26736 :~/bin$ When I try to incorporate this into a shell script I get a blank. Code: :~/bin$ cat process_idesk #!/bin/bash process=`ps -ef | awk ' $8 == "idesk" { print $2 }'` Code: :~/bin$  ./process_idesk :~/bin$ echo $process :~/bin$ The process_idesk script has been chmoded to be executable by the user. I'm sure there must be a silly omission on my behalf. Thanks C (HowTos)