LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Bizarre char set issue? (https://www.linuxquestions.org/questions/linux-software-2/bizarre-char-set-issue-599743/)

jhwilliams 11-14-2007 11:33 PM

Bizarre char set issue?
 
Code:

jameson@navy:~/pix/oxford_1/CCD (Digital)$ for item in `ls 000*`; do mv $item `echo $item | sed 's/^000//g'`; done
mv: cannot stat `\033[00m\033[01;35m00001.jpg\033[00m': No such file or directory
mv: cannot stat `\033[01;35m00002.jpg\033[00m': No such file or directory
mv: cannot stat `\033[01;35m00003.jpg\033[00m': No such file or directory
mv: cannot stat `\033[01;35m00004.jpg\033[00m': No such file or directory

what on earth is going on here? The files are named like: 00007.jpg

Nick_Battle 11-15-2007 07:15 AM

Quote:

Originally Posted by jhwilliams (Post 2959361)
what on earth is going on here? The files are named like: 00007.jpg

Is "ls" an alias for a version which prints listings with pretty colours? (Try "alias" in bash to list your aliases). The --color argument to ls should not produce these escapes if the value is "auto" and the output is not a tty, but it might be "always".

If so, you can either remove the alias (only affects the current shell), or use /usr/bin/ls in the script instead of ls.

HTH,
-nick

jhwilliams 11-15-2007 05:14 PM

Oh right; I had in fact just set that alias a moment before. Cheers!

archtoad6 11-18-2007 06:32 AM

Why were you using:
Code:

for item in `ls 000*`
when
Code:

for item in "000*"
usually produces the same results?

jhwilliams 11-21-2007 02:53 PM

Quote:

Originally Posted by archtoad6 (Post 2962929)
Why were you using:
Code:

for item in `ls 000*`
when
Code:

for item in "000*"
usually produces the same results?

Never tried it that way - my way worked so became habit. Thanks for the short cut!

archtoad6 11-22-2007 11:40 AM

You're welcome.


All times are GMT -5. The time now is 08:20 PM.