| Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
On Mon, 3 Dec 2007 17:45:10 -0600
Brian Medley <[hidden email]> wrote:
> On Mon, Dec 03, 2007 at 03:52:14PM -0500, Matthew Gillen wrote:
>
> > Brian Medley wrote:
> > > On Sun, Dec 02, 2007 at 08:07:14AM -0500, Jerry Feldman wrote:
> > >
> > > Understood, but I don't see the rational of the script to begin
> > > with. The script is "cd" it is part of the OS, but doesn't seem
> > > like it would ever do anything. Also, these files share the
> > > hardlinked file:
> > >
> > > $ ls -lFai cd
> > > 52922 -r-xr-xr-x 15 root wheel 147 Aug 19 2006 cd*
> > > $ s find / -inum 52922
> > > /usr/bin/alias
> > > /usr/bin/bg
> > > /usr/bin/cd
> > > /usr/bin/command
> > > /usr/bin/fc
> > > /usr/bin/fg
> > > /usr/bin/getopts
> > > /usr/bin/hash
> > > /usr/bin/jobs
> > > /usr/bin/read
> > > /usr/bin/type
> > > /usr/bin/ulimit
> > > /usr/bin/umask
> > > /usr/bin/unalias
> > > /usr/bin/wait
> >
> > That means it's using the old unix trick of having one binary that changes
> > behavior based on how it was invoked (ie for different values of argv[0]).
> > The script part is to strip argv[0] down to something that the binary "knows"
> > (ie the /usr/bin/ part is something you don't want hard-coded into the binary).
>
> However, the script doesn't appear to do anything:
>
> sh-2.05b$ alias a
> sh: alias: a: not found
> sh-2.05b$ alias b
> sh: alias: b: not found
> sh-2.05b$ /usr/bin/alias a='echo a'
> sh-2.05b$ alias b='echo b'
> sh-2.05b$ a
> sh: a: command not found
> sh-2.05b$ b
> b
> sh-2.05b$ cat /usr/bin/alias
> #!/bin/sh
> # $FreeBSD: src/usr.bin/alias/generic.sh,v 1.1 2002/07/16 22:16:03 wollman Exp $
> # This file is in the public domain.
> ${0##*/} ${1+"$@"}
> sh-2.05b$