Cygwin and space issue in a script.
Hello there,
I have an issue with spaces in the path of the files. Here is the issue: Code:
#! /bin/bash and the file "07_10_05_file_to_delete.txt" is look like: Code:
/cygdrive/f/FTPRoot/dropbox/log.zip Code:
/cygdrive/f/FTPRoot/dropbox/log.zip Regards, |
use while loop
Code:
while read line; do echo "$line"; done < file |
The reason you are getting this behavior is because $(...) takes the output of its pipeline and replaces all the word separators (e.g. spaces, tabs, newlines) with single spaces. Your for loop iterates over each new word in the list.
To make this a little clearer: Code:
$ echo $(echo one; echo two;) Code:
$ echo one two |
You could set the IFS to newline only at the top of your script; by default it's any of space/tab/newline.
|
Case SOLVED :D
Hi Chrism01,
Yes, you're right, after adding the "IFS=$'\n'" line at the begining of my script it's working fine now. Thank you for your help. Regards, Angel. |
All times are GMT -5. The time now is 02:21 AM. |