Shellscript exited with non-successful status code: 2

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I am trying to execute this shell script on a matched file:

Code: Select all
file=$1

sed -e 's/"Symbol"/"_Symbol"/' -e 's/\//_/g' $file > $file.tmp && mv $file.tmp $file
sort -u -o $file $file



I don't understand what is wrong with this script as it runs perfectly in a bash file. The log just says that the script exited with non-succesful status code :2

Can anyone shed any light on why this doesn't work.
pdoak
 
Posts: 5
Joined: Sat Apr 01, 2017 5:04 pm

Not sure if this is the problem but right off the bat I see that you need to use double quotes around $1. If the path has any spaces in it, it will cause problems.

Otherwise, you'll have to check the man pages of each command you use to see what the error codes are.
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks Mr_Noodle. I will change that.

I found the problem though. The hazel rule had been imported and was pointing to the wrong shell.
pdoak
 
Posts: 5
Joined: Sat Apr 01, 2017 5:04 pm


Return to Support