Why is Bash not recognising my variable as a string? -
i've made bash script. let's call "runner.sh". inside i'm running omxplayer flags.
omxplayer $targetfolder/*.mp4
this works fine. let's resize , position video.
omxplayer —win "0 0 640 480" $targetfolder/*.mp4
this works fine. let's try put "win flag" in variable. i'm escaping quote.
sizeandposition="—win \"0 0 640 480\""
allright, i'm trying out.
omxplayer $sizeandposition $targetfolder/*.mp4
nope, doesn't work. error file "0" not found. sure, print whole command screen.
echo "omxplayer $sizeandposition $targetfolder/*.mp4"
… , output…
omxplayer —win "0 0 640 480" /homefolder/*.mp4
why doesn't recognise variable other string in command? can it?
edit: sorry confusion. question sizeandposition, why not treated argument?
instead of storing command arguments in variable, use array:
sizeandposition=(-win '0 0 640 480') omxplayer "${sizeandposition[@]}" "$targetfolder"/*.mp4
Comments
Post a Comment