Hi Malcolm,
Glad you got to the bottom of it in the end.
On Mon, 3 May 2021, Malcolm Fitzgerald wrote:
> 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
I am wondering what shell you are running here - nothing I have on my
system produces this error (fish, zsh, tcsh, csh, bash, dash). This is
usually because the permissions are wrong (the script is not set to
"executable" with `chmod u+x ProcessSetDeals.sh`, or something similar).
> 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.
Yes, this was a problem. In newer versions of fish (3.1 and newer), you
will get a more useful error that tells you which line is the problem and
why:
fish: Unknown command: 0
foo.fish (line 1):
$status = 0
^
in command substitution
called on line 10 of file foo.fish
foo.fish (line 10): Unknown command
test ( $status = 0 )
^
> 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.
What operating system and version of fish are you using (`fish --version`
will tell you)? It would be worth upgrading in my view.
David Adam
zanc...@ucc.gu.uwa.edu.au
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users