> -----Original Message-----
> From: MET 
> Subject: Re: Shell Script Question || Check for set variable
> 
> 
> I've tried what follows and I still get " if: Expression Syntax ".
> 
> ====
>       #!/bin/tcsh
> 
>       if [ -z "$2" ] ; then
>               echo You have not set a file to be appended.
>               exit 1
>       fi
> ====
> 
> Any ideas?

Your using tcsh as your CLI, not bash. So the syntax would be different.
Try:

#!/bin/tcsh

if ( ! $2 ) then
   echo File not found
endif

If you must use tcsh, then further reading should include man tcsh

Steve Cowles



-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@;redhat.com?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to