Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Log rotation



On Sat, Aug 04, 2001 at 07:21:55AM -0400, Jerry Feldman wrote:
> Note that the [ character is a Unix/Linux command NOT a shell builtin. If 
> you look at /usr/bin on most systems:
> lrwxrwxrwx    1 root     root            4 Jun  3 18:18 [ -> test

While this is true, many modern shells DO implement test as a shell
builtin.  Bash does, as does ksh.  IIRC the Bourne shell did not,
historically, but modern "POSIX" (Bourne-replacement) shells often do,
because implementing it as a shell built-in is much faster than
forking and execing a seperate process.  I have no idea whether
Digital Unix's shells do or do not, having no access to such a system.
See your man page if there's a question.  But I'm not really sure why
this matters...

> So, what that line really is:
> while test read $line ]; do

This is the same behavior for every bourne-compatible shell, and every
POSIX-compliant shell that I know of, regardless of whether test is a
built-in or the executable is used.

> Also note that read is a Unix command, but not a linux command.
> >From Compaq Tru64 Version 4.0F: 
> -rwxr-xr-x   1 bin      bin         1518 Apr 12  1999 /bin/read
> And remember that the original question was in regard to Digital Unix (eg. 
> Tru64).

This again is shell/system dependent, and again probably irrelevant.
There's no /bin/read on Linux, probably because all of its shells
implement the command as a built-in command.  Old versions of read
didn't allow input from redirection, IIRC, but I'm not aware of any
modern implementations that have this limitation.  Otherwise the
behavior of read is generally the same across POSIX-compliant
systems/shells.

> Derek Martin wrote:
> 
> > > while [ read $line ]; do
> > 
> > This test is always true, because the string "read" contains
> > characters.  However, you haven't asked it to read a line, so the
> > variable $line is always null for the duration of your script (unless
> > it inherited a value from the parent shell).  

-- 
---------------------------------------------------
Derek Martin          |   Unix/Linux geek
ddm at pizzashack.org    |   GnuPG Key ID: 0x81CFE75D
Retrieve my public key at http://pgp.mit.edu

-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org