I have a directory ~/test in which several sub-directories are there.
The sub-directory name has spaces and I can not rename them because the name depends on several processes.
The names are like
There is a for loop in a shell script, which is not running successfully because of these spaces.
Code:
#!/bin/bash
lst=$(ls ~/test)
for i in $lst; do echo "$i"; done
it prints the results
It is not correct, I want to use commands in "do" section of loop which needs correct directory name, now a,1,3,2... does not exist that's why the loop is giving error.
Please help