Le 26/04/06, Vincent Pinchart<[EMAIL PROTECTED]> a écrit : > Bonsoir, > > J'ai besoin d'un coup de pouce. > J'ai besoin d'isoler le 'load avg 15m' en une ligne de commande. > > exemple: > > [EMAIL PROTECTED]:~$ uptime > 22:57:56 up 1 day, 2:03, 4 users, load average: 0.12, 0.15, 0.36 > > Je n'ai besoin que du '0.36' afin de l'assigner à une variable. > > Je suis sur qu'un habitué du scripting pourra m'aider. ^^
uptime | perl -nle 'print $1 if m/(([\d\.])+)$/' Pas très efficace, mais ça marche. Avec un seul fork (uptime), en pur shell : uptime=$(uptime) u15=${uptime##* } echo $u15 -- Jérôme Fenal - jfenal AT gmail.com - http://fenal.org/ Paris.pm - http://paris.mongueurs.net/
_______________________________________________________ Linux Mailing List - http://www.unixtech.be Subscribe/Unsubscribe: http://lists.unixtech.be/cgi-bin/mailman/listinfo/linux Archives: http://www.mail-archive.com/linux@lists.unixtech.be IRC: chat.unixtech.be:6667 - #unixtech NNTP: news.gname.org - gmane.org.user-groups.linux.unixtech