Answer the question
In order to leave comments, you need to log in
How to correctly substitute the value of a variable as a command key (space handling)?
Script snippet:
WHATTOBACK="-P Music -P 'Наши документы' -P Работа/Неактуальное"
dar -c ${BACKDIR}`date -I`_"$SERIALNUMBER"_1full $WHATTOBACK
WHATTOBACK="-g Server/"
echo $WHATTOBACK
WHATTOBACK='-P Music -P "Наши документы" -P Работа/Неактуальное'
WHATTOBACK='-P Music -P \"Наши документы\" -P Работа/Неактуальное'
WHATTOBACK='-P Music -P "Наши\ документы" -P Работа/Неактуальное'
WHATTOBACK='-P Music -P Наши\ документы -P Работа/Неактуальное'
WHATTOBACK="-P Music -P 'Наши\ документы' -P Работа/Неактуальное"
Answer the question
In order to leave comments, you need to log in
How can I correctly handle this space and substitute the value of the variable as multiple keys for dar?
WHATTOBACK=( -P Music -P 'Наши документы' -P Работа/Неактуальное )
dar -c ${BACKDIR}`date -I`_"$SERIALNUMBER"_1full "${WHATTOBACK[@]}"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question