Hi I have a munin plugin that does this
load_fetch() {
set -- $(cat /proc/loadavg)
cat <<EOF
load1.value $1
load5.value $2
load15.value $3
EOF
}
I was woundering if any one could tell me what the "set --" is doing? its not an east thing to google for and get results.
http://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html has an explanation. This command (re)sets the argument variables ($1, $2, $3, $4 and $5 in this case).
cat /proc/loadavg
gives you a line with some numbers, feeding the output toset --
maps those numbers to the $N-variables.See for instance:
"Set --" is a bash clause and therefore not specific to munin. Getting to the bash help for the set parameter you can find this:
-- If no arguments follow this option, then the positional parameters are unset. Otherwise, the positional parameters are set to the arguments, even if some of them begin with a `-'.
In your specific case, what it does is map/pass on the contents of cat/proc/loadavg as parameters $1 $2 and $3 so afterwars they can assign them to load1.value, load5.value and load15.value respectively
For further info use man or the following url: http://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html