Re: [SLUG] Scripting question

From: R P Herrold (herrold@owlriver.com)
Date: Sun Sep 08 2002 - 01:16:20 EDT


On Thu, 5 Sep 2002, Smitty wrote:

> Would this also work in bash or just bourne?
> Also the respective arguments are $1 and $2?

No, $1 and $2 are not representative -- they are command line
substitutions to meet your criteria

/bin/sh and bash are not different as I code for many
platforms, and I use a minimalist set of routines which
transport easily ... sorry about the delay -- travelling.

2 minutes of testing. the . exec is not needed with shell
primitives:

bash-2.05a$ ./smitty.sh "echo 234" "echo 345"
234
234
234
234
234
345
bash-2.05a$ ./smitty.sh "echo \" 234\"" "echo \" 345\""
" 234"
" 234"
" 234"
" 234"
" 234"
" 345"
bash-2.05a$ ls -al /bin/sh
lrwxrwxrwx 1 root root 4 May 10 19:21
/bin/sh -> bash
bash-2.05a$ cat smitty.sh
#!/bin/sh
for i in 1 2 3 4 5 ; do
      [ "x$1" != "x" ] && $1
done
[ "x$2" != "x" ] && $2
bash-2.05a$



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:07:46 EDT