run bash script with nice results in error

210 views Asked by At

I have a fairly long bash script. I want to run it with nice

nice ./test1.scr

if I do not run the script with nice, it works great. But when I run it with nice. commands being ran inside my script fail.

commandout=()
while IFS= read -r line # Read a line
do
    commandout+=("$line") # Append line to the array
done < <(tmsh show ltm pool $pool detail | grep -A5 "Ltm::Pool")
commandout+=(" ")

I get the following error if I run the script with nice

./test1.scr: line 269: syntax error near unexpected token `<'
./test1.scr: line 269: `                        done < <(tmsh show ltm pool $pool detail | grep -A5 "Ltm::Pool")'

if I don't run the script with nice everything works ok.

I want to nice the whole script so I can get reduce impact to other processes while this runs

1

There are 1 answers

0
Tony Haynes On

you didn't post as answer so I can't mark it as the answer. But OMG I am soooo freaking dumb.

The script started with #/bin/bash instead of #!/bin/bash that fixed it.