[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Seguito di: cron che non accetta opzioni



On 11/4/24 11:52, Leonardo Boselli wrote:
esatto !

Quindi qualcosa del genere?

$ cat .bin/myscript.sh
#/bin/bash

stanza=$1
field=$2

found=0
while read -r line
do
    f1=$(echo $line | cut -f1 -d:);
    if [ $found -eq 1 ]; then
        f2=$(echo $line | cut -f2 -d: | sed 's/^[[:space:]]*//');
        if [ "$f1" = "$field" ]; then
            echo $f2 | egrep -o '^[[:space:]]*([\+]*[0-9]*[.]*[0-9]*)';
            found=0
            break;
        else
            continue
        fi
    else
        [ "$f1" = "$stanza" ] && found=1 && continue
    fi
done

$ sensors | .bin/myscript.sh "coretemp-isa-0000" "Core 5"
+23.0



Reply to: