Re: /sbin/reboot: symbolic link to `halt'
On Sun, Aug 16, 2009 at 05:22:22PM -0300, Eduardo M KALINOWSKI wrote:
> Chris Bannister wrote:
> > Hi,
> >
> > I noticed that /sbin/reboot is a symbolic link to /sbin/halt. How does
> > the system "know" the difference?
> >
>
> By checking the name with which the program was called. In C it's
> available as the first element in the array of command-line arguments
> that the program receives; other languages have similar means.
>
> There are several programs that behave like this, a look at /usr/bin
> will reveal others.
Mmmm, should have worked that one out. :( I was on the wrong track
thinking $0 was used by bash to find which program to pass the rest of
the arguments to.
Thanks Sven and Eduardo.
--
Chris.
======
I contend that we are both atheists. I just believe in one fewer god
than you do. When you understand why you dismiss all the other
possible gods, you will understand why I dismiss yours.
-- Stephen F Roberts
Reply to: