View Single Post
Old 09-19-2003, 10:38 PM   #3 (permalink)
Dave
Upright
 
Location: Within GMT+10
Boner:
When doing an alias, you don't want to use backticks. The use of backticks in a bourne based shell is to substitute the output of the command between the backticks in place of that string. I guess that makes no sense.

What I mean is if for example you had a command called foo, which does nothing than output "bar". Then if you aliased baz in the method that you specified, when you call baz it would try to call a command bar which may or may not exist. ie:
$ foo
bar
$ alias baz=`foo`
$ baz
bash: bar: command not found

You actually want to use single quotes or double quotes. ie:
$ ls
bar baz foo
$ alias ll='ls -l'
$ ll
total 0
-rw-r--r-- 1 dave dave 0 Sep 20 16:35 bar
-rw-r--r-- 1 dave dave 0 Sep 20 16:35 baz
-rw-r--r-- 1 dave dave 0 Sep 20 16:35 foo

Of course, this doesn't just apply to alias, but bourne derived shells in general (and most also applies to korn and c shells).

Hope that clarifies things.
Dave is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73