stupid shell moans about spaces....
can someone please amend this code so it would work, I have tried everything :'(
Code:
for i in *; do mv $i `echo "$i" | tr '[A-Z]' '[a-z]'`; done thanks, trscookie |
I haven't tested it but have you tried wrapping your first $i in double quotes - e.g. "$i"? Also, have a look here at http://www.linuxquestions.org/questi....php?p=2810545 for a similar question.
|
The shell is not stupid.....it's not smart enough to be stupid. Your example doesn't show it, but the title implies that you have some file names with spaces (bad).
If you have a file name with a space, see what happens when to just try to rename that one file---eg: mv this file newname vs mv "this file" newname |
Ok how about this:
how do I return what the name of the current folder I'm in? for example: if you run pwd it returns the full path I just want to return the last folder that I entered? Cheers again. |
pwd | sed 's,^.*/,,'
(I'm sure there's some other way, too....) |
thanks, I could never get to grips with sed
|
Quote:
Best tutorial I have seen to date..... |
Code:
/bin/ls -1 *[A-Z]* | while read i; do mv "$i" "$(tr '[A-Z]' '[a-z]' <<<"$i")"; done Code:
find . -depth -name '*[A-Z]*' -print | while read i; do mv "$i" "$(tr '[A-Z]' '[a-z]' <<<"$i")"; done |
Quote:
Code:
basename "$PWD" |
All times are GMT -5. The time now is 06:21 AM. |