G
G
Greenberg22021-09-25 15:15:34
linux
Greenberg2, 2021-09-25 15:15:34

Error when starting Bash in WSL (Syntax error)?

Hello! An error occurs when trying to run this wonder in WSL.
app.sh: 5: Syntax error: word unexpected (expecting "do")
mmDPdGnqfFo.jpg?size=875x310&quality=96&sign=3ca38911cfaa5a296107c24492ea63ce&type=album

ad=/path/endfile.mp4
clips_in=/path/
clips_out=/tmp/
for clip in $clips_in/*.mp4; do
  nm=`basename $clip .mp4`
  cat | ffmpeg -f concat -i - -c:v copy -c:a copy $clips_out/${nm}_out.mp4 << EOF
file $clip
file $ad
EOF
done

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Victor, 2021-09-25
@ViZaVi70

Move the "do" in the fourth line to the next line.

B
BorLaze, 2021-09-25
@BorLaze

Damn, well, you were banned in Google, or what?
https://www.cyberciti.biz/faq/bash-for-loop/
Look at the syntax:

for VARIABLE in $(Linux-Or-Unix-Command-Here)
do
  command1
  command2
  commandN
done

We see:
- do on the next line after for
- no before do ;
Also, I suspect you $clips_in/*.mp4'll need to call find with this parameter instead; but it is not exactly

V
vreitech, 2021-09-25
@fzfx

bash and sh are different shells. use bash to run the script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question