M
M
myppomeu2016-01-27 14:35:41
linux
myppomeu, 2016-01-27 14:35:41

Does the IFS variable break the command?

Excerpt from the script:

WHATTOBACK="-P:Music:-P:Фильмы/Старые:-P:Новая папка"
OIFS=$IFS
IFS=':'
dar -R /media/Storage/ -c /media/backup/`date -I` \
-Z "*.[Ff][Ll][Vv]" -Z "*.[Mm][Kk][Vv]" \
-Z "*.[Gg][Zz}" -Z "*.[Xx][Zz]" \
$WHATTOBACK -D
IFS=$OIFS

It seems to work, but I doubt it. Did IFS break something in the team? After all, after dar there are spaces, keys, their values, a backslash.
Am I applying IFS correctly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
Zr, 2016-01-27
@Zr

> Am I using IFS correctly?
I don't know if you are using it correctly IFS, but it all looks rather dumb. Actually, you want to write:

IFS=':' read -ra WHATTOBACK <<< "$WHATTOBACK"
dar ... "${WHATTOBACK[@]}"

J
jcmvbkbc, 2016-01-27
@jcmvbkbc

Am I applying IFS correctly?

Games with IFS usually create more problems than they solve.
The solution to your original problem is in the answer to your other question .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question