Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Fixed | 9 comments | Create New Account
Click here to return to the 'Fixed' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fixed
Authored by: pwharff on Mar 25, '04 03:03:47PM
Why can't we edit our post after we've submitted? So here it is again posted twice and formatted correctly, but this time I'm not so much of an idiot. I forgot to mention with the last script, that if other files in the same directory that do not have spaces in them will be ignored and untouched, however the script will return an error with the "mv" command. So that this is ignored, you could modify the script to send stnderr to /dev/null, that way no matter what, your script will run smoothly. Like such:

for file in * ; do 
   mv "$file" $(echo "$file" | sed 's/ /_/g') 2> /dev/null
done
or

for file in * ; do mv "$file" $(echo "$file" | sed 's/ /_/g') 2> /dev/null ; done


[ Reply to This | # ]