Space in input filename with pipe

Hello,
Normally below script works, could you please comment out what could be the reason of failure if there are spaces in input filename:

script.sh

#!/bin/bash
cd /home/hts/.hts/tvh/
file="$1 $2 $3 $4"
read -d $'\x04' name < "$file"
/usr/bin/ffmpeg -i ""$name"" -vcodec copy -preset superfast -qscale 0 -map 0 -acodec copy -f mpegts -strict -2 pipe:1 < /dev/null

euronews file inside:

When I run this script like this way no problem:

pipe:///home/hts/.hts/tvh/script.sh euronews

EU: Euro News file inside:

Below command not works:

pipe:///home/hts/.hts/tvh/script.sh EU: Euro News

It says

Both files are in the same directory, chown is the same for both files and both files have the same stream source.

Maybe I need to take a fresh air for a while

Thanks
Boris

/usr/bin/ffmpeg -i ""$name""

The redundant quotes mean the variable's not actually quoted at all. Remove the ones marked in red.

1 Like