Request a Free Evaluation: Click Here

MKS Toolkit v9.0 provides tools for instant productivity in both 32 and 64-bit Windows environments with development, testing, or system administration tasks.

With full support for multibyte/Unicode character sets and 64-bit Windows systems, MKS provides support for the newest, most powerful systems all over the world.

9.0 also includes Viw integrated with VisualStudio.NET, Secure Visual File Manipulation and more!
Call 800-637-8034; +1 (703) 803-3343

Recent Articles

Bash In-process Regular Expressions
Bash acquired in-process regular expressions in version 3.0, but I never noticed, probably because most of the machines I'm using are Bash 2.05b.

Personal Dictionary for Ispell
Ispell works well, but it has to be the most confused project I've ever seen. I started looking into this because I got tired of seeing the same common words pop up for correction and wanted to add those words to some file that would cause Ispell to ignore them.

Red Hat, IBM Going After Emerging Markets
Linux and solutions based on that platform will get the big push as the two firms go after the biggest emerging global markets.

Linux Users Encouraged To Help Katrina Victims

A developer wants to organize a public "web station" effort to assist and connect Hurricane Katrina victims. DesktopLinux.com outlines a plan by Steve Hargadon to establish a number of Linux-based web stations...


09.28.05


Bash Aliases


By A.P. Lawrence

Most shells have some provision for aliases. Aliases can assign default behavior to a command (for example "rm" is often aliased to "rm -i") or can be used to create new commands (a typical example is "ll" aliased to be "ls -l").

Aliases are expanded before looking in $PATH. Depending upon your Bash settings, a "which" for a over-ride alias like "rm" may show you the commands found in $PATH also:

bash-2.01$ which rm rm: aliased to rm -i

# a different machine bash-2.05b$ which rm alias rm='rm -i' /bin/rm


To get the second behavior, 'which' itself was aliased :

bash-2.05b$ which which alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' /usr/bin/which

Aliases are NOT normally expanded in non-interactive shells, which means that if you use "rm" in a script, you won't get the alias - unless you want yo, in which case you do "shopt -s expand_aliases" before calling it. If you want to be safe, use /bin/rm instead, which can't ever be confused with an alias.


There are other confusing rules for alias expansion; even the man page admits the potential for gross misunderstanding and follows that confession with this:

For almost every purpose, aliases are superseded by shell functions.

You might construe that as an apology of sorts, but while the maintainers of Bash might fondly hope (and have excellent reasons for hoping) for that to be true, in fact and in common practise, aliases continue to be used regularly and I have little doubt that will remain true for a long, long time.

*Originally published at APLawrence.com

About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com

About LinuxProNews
LinuxProNews is a collection of news and commentary designed to keep you in step with the ever evolving landscape of Linux environments. Opensource News and Advice for Linux Professionals

LinuxProNews is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com DevWebPro.com


-- LinuxProNews is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2005 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article

Opensource News and Advice for Linux Professionals LinuxProNews News Archives About Us Feedback LinuxProNews Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact