converting spaces to underscores

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

 



On Tue, 18 Sep 2001, Thomas Stivers wrote:

> I have recently gotten linux up and running and I am becoming really
> frustrated with the filenames I created in windows which have spaces in
> them. Does anyone know of a utility which can convert all the files in a
> directory so that all the spaces are underscores. I will have to do a lot

This is unnecessary if you switch shells from bash to zsh, and
set the proper completion options: and there lots of other
benefits too.

When I have a long filename to type, I just enter the first few
letters, hit the tab key, and zsh completes the filename for me,
with any spaces escaped (preceded by) a backslash.  If my first
few letters aren't uniq for the files, the completion is made up
to end of the part which identical, and I am presented with a
list of the matching files.  Then I can add a letter or two
followed by another tab, or just keeping hitting tab to cycle
through the choices.  There are options to set, (in a shell
startup file, such as .zshrc), to obtain just about any variation
on this behavior you can imagine.

To try zsh, just type "zsh -l" at your prompt.  To permanently
change your login shell, use the chsh utility.

Keep the scripts others have provided just in case you run across
some non-interactive case where this does not work adequately
(but usually this too can be overcome through some advanced
scripting -- probably you won't care or even notice till you get
such skills).  If you do shell stuff from within some other
utility, such as emacspeak, you may need to set your SHELL
environmental variable, to control which shell gets used.

LCR

-- 
L. C. Robinson
reply to no_spam+munged_lcr@onewest.net.invalid

People buy MicroShaft for compatibility, but get incompatibility and
instability instead.  This is award winning "innovation".  Find
out how MS holds your data hostage with "The *Lens*"; see
"CyberSnare" at http://www.netaction.org/msoft/cybersnare.html





[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]