MLUG: Re: [MLUG] backup via cron
Re: [MLUG] backup via cron
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On Sat, 4 Feb 2006, Stephen Montgomery-Smith wrote:

I personally would call this "feature" of bash a bug. It seems natural to me that it should strip out the ^M's before passing it to growisofs.

(On the other hand, I bet the other shells have this problem also.)


The problem is that it is possible to have a carriage return character in a filename! That may be a strange choice, but it can be done, so the shell has to interpret the character literally or risk making a serious mistake. This is me making a file called "crap^M" in bash, but note that the ^M is not visible (the command line wraps to the next line instead of showing the character):

# echo 'bob' > 'crap
'

# ls crap*
crap?

# cat 'crap
'
bob

# rm 'crap
'

So to do this I hit Ctrl-V Ctrl-J in succession. The Ctrl-V tells the shell to interpret the next character literally. The Ctrl-J produces a Ctrl-M (aka ^M) character, but I don't know why it works that way! I found out because in tcsh, the Ctrl-M produces a ^J, which is visible in tcsh, and so I tried Ctrl-J and found that it produced the ^M.

So a file name can contain a control character in either bash or tcsh. This must occasionally cause some serious problems.

Mike

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members