Why does autostart script on Linux not work

62 views Asked by At

I got an auto start bash script, to start fluidsyth and aconnect command automatically after rebooting my linux system (RPI-3):

#!/bin/bash

(STOP=$((SECONDS+5))
until [[ $SECONDS -ge $STOP || $(ps -C fluidsynth -o stat=) =~ S ]]; do:; done &&
aconnect 20:0 128:0 &)
fluidsynth -a alsa -g 5 /usr/share/sounds/sf2/FluidR3_GM.sf2

When I run this script, it popped up with the following error:

./piano4.sh: line 4: syntax error near unexpected token `done'
./piano4.sh: line 4: `until [[ $SECONDS -ge $STOP || $(ps -C fluidsynth -o stat=) =~ S ]]; do:; done &&'

Till now I cannot solve this error. There are no ^M in the script (I already checked).

Can anyone help me to get it up and running?

Thanks

There are no ^M in the script (I already checked)

1

There are 1 answers

2
Roho On

I found the answer by changing the script into:

#!/bin/bash (STOP=$((SECONDS+15)) until [[ $SECONDS -ge $STOP || $(ps -C fluidsynth -o stat=) =~ S ]]; do echo "" > /dev/null; done && aconnect 20:0 128:0 &) fluidsynth -a alsa -g 5 /usr/share/sounds/sf2/FluidR3_GM.sf2

Thanks