0

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)

Barmar
  • 741,623
  • 53
  • 500
  • 612
Roho
  • 1

1 Answers1

-1

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

Roho
  • 1
  • Nothing in this answer points out the error in the original code. Also the code here is nearly impossible to read and virtually unreadable. – user1934428 Jan 09 '23 at 11:39
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 09 '23 at 13:22