LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Filenames with spaces usin as variable (https://www.linuxquestions.org/questions/linux-newbie-8/filenames-with-spaces-usin-as-variable-4175678530/)

mackowiakp 07-11-2020 06:01 AM

Filenames with spaces usin as variable
 
I have to do the same change in more than 1500 files (video files). In addition, I have a list of these files I have in a single text file. However, the names of these files contain spaces. How can I make these changes to the loop, something like the following shell script. My shell is /bin/sh and not bash. Someone can help me?

Code:

while read p; do
  echo $p #does not display properly video file name
  #My action using $p variable with spaces
done <./files.txt


tinfoil3d 07-11-2020 06:12 AM

its
Code:

echo "$p"
, you must enclose it in double-quotes

syg00 07-11-2020 06:17 AM

I know you're not using ls, but have a read of this.


All times are GMT -5. The time now is 12:26 AM.