Answer the question
In order to leave comments, you need to log in
Console: how to output files with spaces?
Probably, the question is already beaten, but still, I did not find a normal solution.
There is a folder in which there are files with names in Russian, and with spaces (and other terminal special characters) in the names. ls -1
works fine for name in `ls -1`; do echo $name;done;
displays everything in chunks.
How to fix it?
Answer the question
In order to leave comments, you need to log in
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for name in `ls -1`; do echo $name;done;
IFS=$SAVEIFS
you can just wrap `ls -1` and $name with double quotes:
for name in "`ls -1`"; do echo "$name";done;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question