![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sh -help with case statement (should be simple) | kuliksco | Shell Programming and Scripting | 1 | 11-19-2007 10:04 PM |
| Help with if statement in ksh script | stepnkev | Shell Programming and Scripting | 2 | 05-07-2007 02:25 PM |
| Script does not execute Insert Statement | Amruta Pitkar | Shell Programming and Scripting | 4 | 08-25-2006 12:14 AM |
| What's wrong with this simple statement? | mharley | Shell Programming and Scripting | 7 | 03-04-2005 07:30 AM |
| Shell script automation using case statement | ianf | Shell Programming and Scripting | 6 | 09-12-2002 10:17 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Using simple if statement in script
Hello, I am trying to create a simple script that will check the disk usage of a drive, and if it is over the limit it will delete the oldest ten files. everything is working except for when i implement the if statement i get the error /usb0: zero divisor. I am pretty sure that the du -k /usb0 command is putting whitespace before the actual available space and that is causing the problem. Is there a way to get around that? thanks Code:
diskusage=`du -k /usb0` echo "Current disk usage: $diskusage" x=0 if [ "$diskusage" -gt 200000 ] ; then while [[ $x -lt 2 ]] ; do deletefile=`ls /usb0 | head -1` echo "Deleting File Now..." rm /usb0/"$deletefile" echo "File $deletefile was removed." x=`expr $x + 1` done fi Last edited by bpage; 05-12-2008 at 02:38 PM.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|