scripts

misc scripts and tools
git clone git://git.2f30.org/scripts
Log | Files | Refs

commit f8a666b3c1cdd50a3f25c9525d97a5f98b2d79f2
parent 0a87e9e81d4ff9a1c5cb32b71144a57125e8da08
Author: Eddie Thieda <eddie.thieda@gmail.com>
Date:   Sun, 29 Apr 2018 13:17:41 -0400

I created a new function for displaying the current volume level and print it out if you enter a correct or incorrect value.

Diffstat:
Mvolume | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/volume b/volume @@ -2,12 +2,16 @@ #OpenBSD volume control #normalizes the input percentage to 0-255 +printvol() { + currval=$(mixerctl|grep outputs.master\=|awk -F"," '{print $NF}') + currval=$(echo $currval "/ 2.55"|bc) + echo "Current level:" $currval "%" +} + usageexit() { typeset -i currval echo "usage:" "$(basename $0) [0-100]" - currval=$(mixerctl|grep outputs.master\=|awk -F"," '{print $NF}') - currval=$(echo $currval "/ 2.55"|bc) - echo "Current level:" $currval "%" + printvol exit } @@ -19,6 +23,7 @@ case $1 in typeset -i volvar volvar=$(printf "%1.0f" $(echo $1 "* 2.55" |bc)) mixerctl -n outputs.master=$volvar,$volvar + printvol ;; *) usageexit