On Fri, Feb 25, 2000 at 08:15:06PM -0800, Hidong Kim wrote:
| Thanks for getting me started on translating scripts from csh to sh.
| After reading some manuals, I thought I had translated everything OK,
| but in fact, I haven't. When I try to run the sh script, I get this
| error:
|
| ./msi_lic_bash: [: missing `]'
| ./msi_lic_bash: [: too many arguments
| ./msi_lic_bash: [: too many arguments
| ./msi_lic_bash: [: missing `]'
Can you quote your current sh script back so we can see how it looks at
your end?
>From the stuff waaayyy down in your article:
| > if [ ${BIOSYM:=undefined} == undefined ]
If BIOSYM had space in it it could be broken into separate words. You
want to quote it to prevent the shell doing whitespace interpretation
of its value:
if [ "${BIOSYM:=undefined}" == undefined ]
or you could just say
if [ -z "$BIOSYM" ]
which means the same thing in this instance.
| What could these errors mean? I've gone through the script and checked
| that all "[" were paired with "]". Also, I'm not entirely sure about
| the translation of the following csh block:
|
| if (-e $rel_data) then
| set lic_pack = `cat $rel_data | egrep "^MSI_LIC_PACK_DIR"`
| if !($status) then
| set lp_dir = `echo $lic_pack | awk -F: '{print $2}'`
| set lic_dir = $lp_dir/licenses
| setenv MSI_LIC_PACK_DIR $lp_dir
| endif
| endif
|
| I don't know quite what to do with the line "if !($status) then".
$status is the csh variable for the exit status of the previous command;
zero means success. Csh's if is rather arithmetic in outlook.
The equivalent shell would be:
lic_pack=`egrep "^MSI_LIC_PACK_DIR" <$rel_data`
if [ $? = 0 ]; then
I've taken the liberty of rewriting "cat $rel_data | egrep "^MSI_LIC_PACK_DIR""
to be shorter and more efficient, too.
Cheers,
--
Cameron Simpson, DoD#743 [EMAIL PROTECTED] http://www.zip.com.au/~cs/
Holly: Emergency. Emergency. There's an emergency going on. It's still going
on. It's still an emergency. This is an emergency announcement.
- Red Dwarf, _Confidence and Paranoia_
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.