Re: Shell scripting tips and tricks (was: I need a date! )

2002-04-22 Thread Jerry Feldman
Actually, [ is a link to test. Linux uses a symlink, some Unixes use hard links. -rwxr-xr-x1 root root17496 Sep 20 2001 /usr/bin/test lrwxrwxrwx1 root root4 Dec 1 13:42 /usr/bin/[ - test And yes, BASH has it built in, but on some of the older Bourne shells

Re: Shell scripting tips and tricks (was: I need a date! )

2002-04-22 Thread Tom Buskey
Jerry Feldman said: Actually, [ is a link to test. Linux uses a symlink, some Unixes use hard links. -rwxr-xr-x1 root root17496 Sep 20 2001 /usr/bin/test lrwxrwxrwx1 root root4 Dec 1 13:42 /usr/bin/[ - test And yes, BASH has it built in, but on some of

Re: Shell scripting tips and tricks (was: I need a date! )

2002-04-22 Thread Steven W. Orr
=Jerry Feldman said: =Actually, [ is a link to test. Linux uses a symlink, some Unixes use hard =links. =-rwxr-xr-x1 root root17496 Sep 20 2001 /usr/bin/test =lrwxrwxrwx1 root root4 Dec 1 13:42 /usr/bin/[ - test = =And yes, BASH has it built in, but on some

Re: Shell scripting tips and tricks (was: I need a date! )

2002-04-22 Thread Karl J. Runge
On Mon, 22 Apr 2002, Tom Buskey [EMAIL PROTECTED] wrote: As I said in not so many words, modern shells have it built in. I don't consider Bourne a modern shell. I believe Jerry is saying some of the newer implementations of /bin/sh have [ as a builtin. For example, [ has been a builtin on

Re: Shell scripting tips and tricks (was: I need a date! )

2002-04-22 Thread Jerry Feldman
That is also correct. I had forgotten. But, my original point is that it is probably better to specify the full pathname of a command. X=$(/bin/ls) will generally result in identical results as: PATH=/bin:$(PATH) X=$(ls) But, specifying the full pathname also forces the command to be executed

Re: Shell scripting tips and tricks (was: I need a date! )

2002-04-22 Thread Jerry Feldman
Yes, but several Unix systems supply an old style Bourne SH as well as a POSIX shell (essentially ksh scaled down) and ksh. KSH implemented the [[ as a way of internalizing the condition. For the most part, the syntax will work in most Bourne derived shells. if [ condition ] then #

Re: Shell scripting tips and tricks (was: I need a date! )

2002-04-22 Thread Derek D. Martin
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 At some point hitherto, Jerry Feldman hath spake thusly: Actually, [ is a link to test. Linux uses a symlink, some Unixes use hard links. -rwxr-xr-x1 root root17496 Sep 20 2001 /usr/bin/test lrwxrwxrwx1 root root

Re: Shell scripting tips and tricks (was: I need a date! )

2002-04-21 Thread Tom Buskey
Benjamin Scott said: If you are not interested in portability to older shells, here are some optimizations: math=$(( 1 + 1 )) # internal, easier, nestable if [[ a = b ]]; ... # internal I've had problems with [[ ]] on pdksh in the past. [ ] is

Re: Shell scripting tips and tricks (was: I need a date! )

2002-04-21 Thread Derek D. Martin
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 At some point hitherto, Tom Buskey hath spake thusly: I've had problems with [[ ]] on pdksh in the past. [ ] is also internal on modern unixen. You can get the real ksh from David Korn's website. It's now freely available, though I don't know

Re: Shell scripting tips and tricks (was: I need a date! )

2002-04-21 Thread Steven W. Orr
On Sun, 21 Apr 2002, Derek D. Martin wrote: =-BEGIN PGP SIGNED MESSAGE- =Hash: SHA1 = =At some point hitherto, Tom Buskey hath spake thusly: = = I've had problems with [[ ]] on pdksh in the past. [ ] is also = internal on modern unixen. = =You can get the real ksh from David Korn's

Shell scripting tips and tricks (was: I need a date! )

2002-04-20 Thread Benjamin Scott
On Fri, 19 Apr 2002, at 5:25pm, Thomas M. Albright wrote: it's the only way i know to add to variables: today=`date +%j` let tomorrow=$today+1 If you are not interested in portability to older shells, here are some optimizations: math=$(( 1 + 1 )) # internal,