Thread Ausgabe Zahlen -> if (4 answers)
Opened by Goof120 at 2021-09-28 13:56

Gast Goof120
 2021-09-28 13:56
#193600 #193600
Hi,

ich habe folgende frage:

Code (perl): (dl )
1
2
3
4
5
my @ente = map { "\/dev\/sd$_" } ('x', 'y', 'z');

foreach my $h (@ente) {
    my $output = "smartctl \-l ssd $h| grep Percent | cut \-c 29,30 ";
 }


hier bekomme ich für meine 3 Festplatten nun 3 Zahlen raus.

z.b

40
60
90

wenn eine Zahl über 89 ist will ich das er mir einen exit code 2 gibt

wie mache ich das?

if $output > 89 then exit 2?

das funktioniert aber nicht wie ich mir es vorstelle

modedit Editiert von GwenDragon: Code formatiert
Last edited: 2021-09-28 16:11:14 +0200 (CEST)

View full thread Ausgabe Zahlen -> if