Sponsored Content
Full Discussion: help me plz with df
Top Forums Shell Programming and Scripting help me plz with df Post 302198917 by djdes22 on Sunday 25th of May 2008 06:58:33 AM
Old 05-25-2008
Java help me plz with df

i try write script for check space disk and if >87% then try find file in /.../mp3/ and delete only 5gb OLD file. i try this

root@des:/media/generaly# nano 1111.sh
Code:
i#!/bin/sh
if [ $(df -h | awk '/dev/sdc1 {if ($5>"86%") {print 1} else {print 0}}') = "1" ];
then
print fuck
fi

root@des3:/media/generaly# . 1111.sh
bash: [: too many arguments
root@des:/media/generaly# sh 1111.sh
[: 6: 0: unexpected operator
root@des:/media/generaly# df -k |awk '/dev/sdc1 {if ($5>"86%") {print 1} else {print 0}}'
1
0
0
0
0
0
0
root@des:/media/generaly#

and perl script
root@des:/media/generaly# nano 1111.pl
Code:
#!/usr/bin/perl
@result = qx{df};
foreach $elem (@result) {
if ($elem =~ /dev\/sdc1.+ (.\d)\%.+/) 
{
if ($1 > 87)
{
print fuck
}

root@des:/media/generaly# . 111.pl
bash: @result: command not found
bash: 111.pl: line 3: syntax error near unexpected token `('
bash: 111.pl: line 3: `foreach $elem (@result) {'

root@des:/media/generaly# ./111.pl
Missing right curly or square bracket at ./111.pl line 9, at end of line
syntax error at ./111.pl line 9, at EOF
Execution of ./111.pl aborted due to compilation errors.
root@des:/media/generaly#

sorry im noob in programming, and dont know what he wonna say me or what i need write to the end file.
:-[
but
root@webmp3:/media/generaly# df -k /dev/sdc1|grep %|awk '{print $5}'|sed 's/%//g'
Use
89
root@webmp3:/media/generaly#

plz help me with this shit :\
os: ubuntu 8.04 x64
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

plz Help How should I configure cc compiler output file plz help???

i.e configuration of C compiler :confused: (4 Replies)
Discussion started by: atiato
4 Replies

2. Programming

plz help!

i'm pretty new to unix programming. i just wanna know how exactly fork(), waitpid() works. i have read some from the book, but it's still confusing. especially with those < 0 and == 0. plz help!!!! (1 Reply)
Discussion started by: ligerdave
1 Replies

3. Programming

plz help

alright, i just got this assignment. since im very new to unix programming, i would like to have some ideas about it. honestly, i dont even know what the hell he is asking for. plz see the attached pdf and help me out. thank you :( (2 Replies)
Discussion started by: ligerdave
2 Replies

4. UNIX for Dummies Questions & Answers

plz help me

how i can download the game plz tell me ????? ty :) :) :) (3 Replies)
Discussion started by: Sora21
3 Replies

5. Shell Programming and Scripting

Plz help

I am a newbie to Unix, I am using vi editor. I was able to print output to the screen using simple scripts. But when I tried a midlevel script I don't see anything on the screen and Cursor is just blinking when I type ./test11 filename. I have used chmod 755 also, but of no use. Any help would... (3 Replies)
Discussion started by: Mandab
3 Replies

6. Solaris

can anyone help plz

hi I have been given a new Sun fire V120 which i had no use for but my firend wished to host a maple story sever on it so i was happy to let him use it but i have run in to the problem that i have no clue how to configure it so he can use it if anyone can help we would realy appreciate it. Am... (1 Reply)
Discussion started by: rdsars
1 Replies

7. Shell Programming and Scripting

plz help me

this script reads source.txt and move and random choice 6 files among 25 txt file and renmame it.. but it is not executed.. whats problem? #!/bin/ksh while read line do cd $line/radmin num=0 /bin/ls *.txt | while read file_nm ; do (( check = $RANDOM % 2 )) if ; then continue... (1 Reply)
Discussion started by: topic32428285
1 Replies

8. UNIX for Dummies Questions & Answers

PLZ help..!!

plz help me with this question : 1111 | aaaa | pppp | 23/9/87 3333 | dddd | oooo | 6/9/8 4444 | gggg | rrrr | 5/8/9 5555 | qqqq | eeee ans: 5555 | qqqq | eeee depending upon how many "|" are in the question be quick.. (8 Replies)
Discussion started by: adityamitra
8 Replies

9. Shell Programming and Scripting

plz help me

hi... i want to print the below format by using shell scripting...plz help me 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 Thanking u in advance... regards ram (1 Reply)
Discussion started by: ram_pl
1 Replies
CheckDigits::M10_001(3pm)				User Contributed Perl Documentation				 CheckDigits::M10_001(3pm)

NAME
CheckDigits::M10_001 - compute check digits for Bahncard (DE), IMEI, IMEISV, ISIN, Miles&More, Payback (DE), Personnummer (SE), Passport (BR), Credit Cards, SSN (US), Samordningsnummer (SE), VAT RN (ES), VAT RN (IT), VAT RN (SE), International Securities Identifikation Number (ISIN) SYNOPSIS
use Algorithm::CheckDigits; $visa = CheckDigits('visa'); if ($visa->is_valid('4111 1111 1111 1111')) { # do something } $cn = $visa->complete('4111 1111 1111 111'); # $cn = '4111 1111 1111 1111' $cd = $visa->checkdigit('4111 1111 1111 1111'); # $cd = '7' $bn = $visa->basenumber('4111 1111 1111 1111'); # $bn = '4111 1111 1111 111' DESCRIPTION
ALGORITHM 1. Beginning right all numbers are weighted alternatively 1 and 2 (that is the check digit is weighted 1). 2. The total of the digits of all products is computed. 3. The sum of step 3 ist taken modulo 10. 4. The check digit is the difference between 10 and the number from step 3. To validate the total of the digits of all numbers inclusive check digit taken modulo 10 must be 0. METHODS is_valid($number) Returns true only if $number consists solely of numbers and the last digit is a valid check digit according to the algorithm given above. Returns false otherwise, complete($number) The check digit for $number is computed and concatenated to the end of $number. Returns the complete number with check digit or '' if $number does not consist solely of digits and spaces. basenumber($number) Returns the basenumber of $number if $number has a valid check digit. Return '' otherwise. checkdigit($number) Returns the checkdigit of $number if $number has a valid check digit. Return '' otherwise. EXPORT None by default. AUTHOR
Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de> SEE ALSO
perl, CheckDigits, www.pruefziffernberechnung.de. For IMEI, IMEISV: ETSI Technical Specification TS 100 508 (v6.2.0) perl v5.10.0 2008-05-17 CheckDigits::M10_001(3pm)
All times are GMT -4. The time now is 08:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy