P
P
petrov_ruslan2017-10-10 23:33:31
bash
petrov_ruslan, 2017-10-10 23:33:31

Bash script to read line by line?

The script does not read all the lines in the file and the video playback does not occur except for the first one

#!/bin/sh
SERVICE="/usr/bin/omxplayer"
file="/home/pi/Documents/list.txt"
while read line; do
        $SERVICE -b $line
done < $file

UPD
The bottom line is to give the program a path with a video file as input.
The result is this code, but it does not work correctly.
SERVICE="/usr/bin/omxplayer"
file="/home/pi/Documents/list.txt"
while read line; do
        while ps ax | grep -v grep | grep omxplayer; do sleep 1s; done
        $SERVICE -b $line
done <$file

The program crashes with the message
stack smashing detected /usr/bin/omxplayer.bin terminated
/usr/bin/omxplayer: line 67: 4873 Aborted
PLAYER_LIBS${LD_LIBRARY_PATH: +:$LD_LIBRARY_PATH}" $OMXPLAYER_BIN "[email protected]"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2017-10-11
@jcmvbkbc

$SERVICE -b "$line"

D
Denis Verbin, 2017-10-11
@rez0n

Here's the same script, just finished :)
Where can I add sort --random-sort to the script?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question