M
M
MusicMan_082018-09-24 14:13:42
linux
MusicMan_08, 2018-09-24 14:13:42

Why does bash change a variable?

Help to deal with the script:
There is a condition where a name is assigned to the variable view1

# Check MY-SERVER
if ffmpeg -f libndi_newtek -find_sources 1 -i dummy 2>&1 | grep 'MY-SERVER (1)'
then
        view1=" -f libndi_newtek -thread_queue_size 1024 -i 'MY-SERVER (1)'"
        echo "MY-SERVER (1) is running! Everything is fine..."

Next, I try to use the value of a variable in a script:
# Run FFMPEG
ffmpeg -hwaccel cuvid $view1 $view2 $view3 
...
...
...

FFMPEG returns error because variables are not expanded correctly:
-f libndi_newtek -thread_queue_size 1024 -i ''\''MY-SERVER' '(1)'\'''

And I need it to turn out exactly as specified in the variable:
-f libndi_newtek -thread_queue_size 1024 -i 'MY-SERVER (1)'

Can't figure out how to achieve this?
Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2018-09-24
@MusicMan_08

And so
ffmpeg -hwaccel cuvid "$view1" "$view2" "$view3"

S
Sergey, 2018-09-24
@kRosis

Try this
so?
or so

IFS=$'\n'
view1=" -f libndi_newtek -thread_queue_size 1024 -i 'MY-SERVER (1)'"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question