![]() |
|
|
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 |
| how to find a file named vijay in a directory using find command | amirthraj_12 | UNIX for Dummies Questions & Answers | 6 | 10-25-2008 01:37 PM |
| to find the file with full path | surjyap | Shell Programming and Scripting | 5 | 01-18-2008 03:26 PM |
| How to delete Directory and inside files using Find command | bmkreddy | SUN Solaris | 3 | 07-10-2007 03:35 PM |
| i want to delete a file based on existing file in a directory | srivsn | Shell Programming and Scripting | 3 | 04-11-2006 05:38 AM |
| Script to cd into newest (dated) FTP directory | steved | Shell Programming and Scripting | 3 | 01-17-2006 02:04 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I want to write a code that will look for a particular directory which is full or more than 95% used, and will search older file and delete it. My code looks like this: Code:
df -k|while read f1 f2 f3 f4 f5 f6 do if expr '$f5' -ge '95%' || continue then echo $f5 else echo "there is no critical situation!" fi done find . -name "*" -size +100k |sort -nr |tail -1\ #find /cbmdata/00/gdd -name "LOGS*" |sort -nr |tail -1\ while read line do rm -f $line done of course upper part doesn t work to comparison because I need to format 95% to decimal 95, but I couldn't . Can you please advise me a convert method? |
|
||||
|
can I put an else if there is no problem in this case ??
I tried your code and worked, thanks. last updated code : Code:
ref=95 rep=0 df -k | tr -d '%' | \ while read a b c d e other do if (( $e >= $ref )) || continue then rep=$e echo $rep fi done can I take an else to indicate there is no full disk? Thanks again |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|