Re: tcsh bug



In article <1159450277.151149.40600@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"blue" <singh.sundeep@xxxxxxxxx> wrote:

Hi,
Can someone explain this weird behaviour...
I have a script like this:
******************************************************************************
*******
#! /bin/tcsh -f
# tcsh 6.12.00

if (-e Hce.res) then
fgrep PASSED Hce.res >& /dev/null
if ($status)then
# If you put a space between "($status)" and "then" things work fine.
echo "Hce.res exists:: FAIL1: HCE "
else
echo "Hce.res exists:: PASS2: HCE Test"
endif
else
echo "Hce.res does NOT exist:: FAIL3: "
endif
******************************************************************************
*******

I am executing it on Red Hat Enterprise 3.0, Intel x86.
Even when the file "Hce.res" is absent, it prints "Hce.res exists::
PASS2: HCE Test".
The shell dosen't complain of any syntax error in script.

csh and tcsh are sometimes very picky about whitespace. One of many
reasons not to use them for scripting.

--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.



Relevant Pages

  • Re: When was /dev/cua* depreciated?
    ... but that first script edits startup scripts itself! ... Actually the kernel module bit is the best quality by far, ... assumed that any shipped software will be entirely useless and must be ...
    (uk.comp.os.linux)
  • Re: Disc space: How low can you go?
    ... here's a script that i use *a lot* for monitoring my systems. ... echo!calculates the amount of free space on the ... setvar _vf_volume ups ...
    (comp.sys.hp.mpe)
  • Re: MS02-052
    ... to be understood that this message implies that the update has been ... > script that checks the msjava.dll file and the registry entry as well. ... >> For everyone who's interested in updating ms java from a KIX script. ...
    (microsoft.public.security)
  • Re: MS02-052
    ... script that checks the msjava.dll file and the registry entry as well. ... Rename from .vbs.txt to just .vbs, ...
    (microsoft.public.security)
  • Re: MS02-052
    ... >> script that checks the msjava.dll file and the registry entry as well. ... >>> exit ... >>> endif ...
    (microsoft.public.security)