Why doesn't the section "Command Substitution" in the otherwise
excellent documentation say, "you are only allowed to use command
substitution in X and Y" or perhaps "you are not allowed to use command
substitution in Z", or simply, "Don't wrap test statements in round
brackets." This addendum would/could/might help someone like me in the
future.
TLDR; version:
I have been bumping my head against a wall trying to discover why I was
seeing this error message.
$ ./ProcessSetDeals.sh
Failed to execute process './ProcessSetDeals.sh'. Reason:
exec: Operation not permitted
At first I thought it was a user permission problem, so I used sudo
$ sudo ./ProcessSetDeals.sh
Password:
sudo: unable to execute ./ProcessSetDeals.sh: Operation not permitted
That didn't help. I'm kinda new to shell scripting, so I don't have a
lot of experience to fall back on. After too many rounds of doing the
same things in slightly different ways I tried this.
$ /usr/local/bin/fish ./ProcessSetDeals.sh
./ProcessSetDeals.sh: Command substitutions not allowed
<W> fish: Error while reading file ./ProcessSetDeals.sh
I really hadn't expected to get an easter egg. If only I knew what to do
with it.
Unfortunately I had used command substitution everywhere. It wasn't
until I'd removed all the functions and all the control structures that
I could get my script to run. That made me desperate enough to read the
documentation (again!) and while I was doing that I found the address
for this mailing list. Not exactly hidden but I don't imagine it's a
high volume list.
Then, to figure out what help to ask for, I was testing the lines that
used command substitution and I discovered this:
$ if ( test $status = 0
)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
Â
fish: Command substitutions not allowed
if ( test $status = 0 )
  ^
Wow. In hindsight that was easy and I've learnt a lot of fishy things
from the documentation too, so there are upsides to the learning process.
thanks for the great shell,
Malcolm
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users