help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Non printable ASCII characters in a file name


From: Greg Wooledge
Subject: Re: [Help-bash] Non printable ASCII characters in a file name
Date: Mon, 23 Apr 2012 12:22:56 -0400
User-agent: Mutt/1.4.2.3i

On Mon, Apr 23, 2012 at 12:17:45PM -0400, Greg Wooledge wrote:
> If the file has several normal characters in it (or is the only file in
> the directory), then you can use a glob:
> 
> $ ls
> foobar?baz
> $ mv foobar*baz foobarbaz
> 
> If you want to enter the character explicitly, then you can use bash's
> $'...' quoting:
> 
> $ ls -b foobar*baz
> foobar\002baz
> $ mv $'foobar\002baz' foobarbaz

Oh, duh... I forgot one:

If the filename *begins with* lots of normal characters, you can probably
use tab completion to let bash spell it out for you:

$ mv foobar<TAB>
... becomes ...
$ mv foobar^Bbaz

(I've typed ^B in the email, but in the actual shell, that's a  character.
You can verify that by moving the cursor over it... the cursor will jump
two spots when moving from the ^ to the b or vice versa.)

Bash's tab completion will select some representation of the character that
allows the command to work.  It may include the character literally like
it did in this example, or it might backslash-escape it, or whatever.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]