IT-DISCUSS Archives

June 2006

IT-DISCUSS@LIST.UVM.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Wesley Alan Wright <[log in to unmask]>
Reply To:
Technology Discussion at UVM <[log in to unmask]>
Date:
Wed, 28 Jun 2006 11:18:15 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (51 lines)
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/    |

ATOM RSS1 RSS2