Code Sample |
$ cat .cpufreq.sh #!/bin/sh cpufreq-info -mf | awk '{printf $1 " " $2}' # $ cat .cpugov.sh #!/bin/sh cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor | awk '{printf $1}' # $ cat .laptop_mode.sh #!/bin/sh sudo /etc/init.d/laptop-mode status | grep "drive state is:" | cut -b22- | awk '{printf $1}' # |
Code Sample |
${color red}$hr ${color grey}Uptime: $color $uptime ${color #ddd}Battery: $color ${battery} ${color #ddd}CPU Temp: $color ${acpitemp} degC ${color grey}CPU Freq: $color ${execi 180 ~/.cpufreq.sh} ${color grey}CPU Govn: $color ${execi 180 ~/.cpugov.sh} ${color grey}/dev/hda: $color ${execi 180 ~/.laptop_mode.sh} ${color green}$hr$color |
Quote |
If you're using awk, you may as well do all of the parsing in it. |
Code Sample |
echo 123 | tr -d '\n' |
Code Sample |
sudo /etc/init.d/laptop-mode status | grep "drive state is:" | cut -b22- | awk '{printf $1}' |
Code Sample |
sudo /etc/init.d/laptop-mode status | awk '/drive state is/{printf $4}' |
Code Sample |
$ cat .cpufreq.sh #!/bin/sh cpufreq-info -mf | tr -d '\n' # $ cat .cpugov.sh #!/bin/sh cpufreq-info -p | awk '{printf $3}' # $ cat .laptop_mode.sh #!/bin/sh sudo /etc/init.d/laptop-mode status | awk '/drive state is/{printf $4}' # |