Subject: | |
From: | |
Reply To: | |
Date: | Wed, 28 Jun 2006 11:30:55 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
So I guess this is why I'm tearing my hair out. I WOULD use Perl, but
my script works fine except for this one 'if' statement (The BASH code
gave me a syntax error - so I guess I'm using something else) and I
don't want, right now, to start learning a new approach (fiscal
year-end is right around the corner).
Shouldn't someone be able to say - "OK, because you don't specify
otherwise in your script, you are using this scripting language version
x.xxxx and you can get up-to-date documentation at this web site?"
AllIwanando is write a working "if" statement.
Sorry, if this sounds a little rantish.
cdt
Quoting Wesley Alan Wright <[log in to unmask]>:
> On Jun 28, 2006, at 10:53 AM, Mike Austin wrote:
>
>> Curt Duncan Taylor wrote:
>>> Here I am pulling my hair out because I can't find the proper
>>> suntax to write an 'if' statement that says "if the file ~HOME
>>> \test.lis exist, then delete it."
>>> Where do I find documentation for the proper version of Unix
>>> scripting that is being used on Girrafe at UVM?
>>
>> There are several shell options available on giraffe. What shell
>> were you trying to use?
>>
>> If you use bash, syntax like:
>>
>>
>> #!/bin/bash
>
> and if you use #!/bin/tcsh or #!/bin/csh or if you use #!/bin/sh , it
> all might be different.
>
> So, you read the documentation, which amounts to typing
>
> man bash
>
> which displays the bash manual pages. Try finding conditional syntax
> there -- ouch
>
> My advice: shell scripts are whack. Use perl. Find local
> documentation (dated, but still usable) at http://www.uvm.edu/perl5 .
>
> Now we have
>
> #!/usr/bin/perl
>
> $TESTFILE=$ENV{'HOME'}."/test.lis/";
>
> if (-e $TESTFILE) {
> unlink $TESTFILE;
> } else {
> print "$TESTFILE does not exist\n"
> }
>
> -----------------------------------------------------------------------
> | Wesley Alan Wright <mailto:[log in to unmask]> |
> | Academic Computing Services __0__ |
> | Room 238 Waterman Building / \ | \ |
> | University of Vermont \77 |
> | Burlington, Vermont 05405-0160 USA. \\ http://www.uvm.edu/skivt-l |
> | Voice:802-656-1254 FAX:802-656-0872 vv |
> | aim:goim?screenname=maddogskideath http://www.uvm.edu/~waw/ |
>
|
|
|