Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Using HFS capitalization features with shell aliases UNIX
For those of us who routinely create aliases with the same name as an actual command, e.g. (in Bourne style):
 alias cp='cp -i'
 alias ls='ls -ACF --color'
 alias mv='mv -i'
 alias rm='rm -i'
The case-respecting / case-ignoring aspect of HFS under Darwin means that you can get the original unaliased command by changing capitalization. That is, typing ls will use the alias, but typing LS, Ls, or lS will run the "ls" binary directly with no alias.

Of course, UNIX users already know you can do it with escape characters, by typing \ls, but this is a neat Darwin quirk.
    •    
  • Currently 2.00 / 5
  You rated: 3 / 5 (2 votes cast)
 
[3,074 views]  

Using HFS capitalization features with shell aliases | 3 comments | Create New Account
Click here to return to the 'Using HFS capitalization features with shell aliases' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Using HFS capitalization features with shell aliases
Authored by: feelgood on May 06, '03 12:46:04PM

Unix users also already know that you can bypass an alias by putting the aliased command in single quotes. E.g. - 'ls' -lrt



[ Reply to This | # ]
Using HFS capitalization features with shell aliases
Authored by: merlyn on May 07, '03 10:08:27AM

Overloading an existing command like this is always a bad idea. If you want an rm with "-i", create an alias called "rmi" or "ri", and learn to use that.

Otherwise, the first time you type the same command on a place where the aliases are NOT in place, you'll get the original old behavior. Ooops!

Never, never, never overload an existing command.

Just a hint from a guy who has been using Unix for 26 years (yeah, that's longer than some of you have been on the planet {grin}).



[ Reply to This | # ]
Using HFS capitalization features with shell aliases
Authored by: david-bo on May 09, '03 05:09:17AM

This is, of course, completely BS.

Feel free to overload any program but spend a second thought on what you overload and how. Obviously, overloading rm can cause dangerous situations, but overloading ls to ls -a is harmless, the only sideeeffect is a sligthly unexpected output.

---
http://www.google.com/search?as_q=%22Authored+by%3A+david-bo%22&num=10&hl=en&ie=ISO-8859-1&btnG=



[ Reply to This | # ]