Chinaunix首页 | 论坛 | 博客
  • 博客访问: 387416
  • 博文数量: 81
  • 博客积分: 45
  • 博客等级: 民兵
  • 技术积分: 608
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-22 11:46
个人简介

一个愤青

文章分类

全部博文(81)

文章存档

2015年(40)

2014年(29)

2013年(11)

2012年(1)

我的朋友

分类: LINUX

2014-09-02 01:22:41


点击(此处)折叠或打开

  1. #!/bin/bash

  2. # code by slucx

  3. function usage() {
  4.     pro=$(basename $0)
  5.     echo "Welcome to $pro, version 0.1"
  6.     echo "code by slucx(slucx@sina.com)"
  7.     echo "$pro add/sub/mute/help"
  8.     echo "arguments:"
  9.     echo -e "\t add - increase the sound volume"
  10.     echo -e "\t sub - decrease the sound volume"
  11.     echo -e "\t mute - toggle mute and not"
  12.     echo -e "\t help - print this document"
  13. }

  14. if [ $# != 1 ]; then
  15.     usage
  16.     exit
  17. fi

  18. case $1 in
  19.     "add")
  20.     amixer set Master 2%+ unmute
  21.     amixer set PCM 2%+ unmute
  22.     ;;
  23.     "sub")
  24.     amixer set Master 2%- unmute
  25.     amixer set PCM 2%- unmute
  26.     ;;
  27.     "mute")
  28.     amixer set Master toggle
  29.     amixer set PCM toggle
  30.     ;;
  31.     "help")
  32.     usage
  33.     exit
  34.     ;;
  35. esac

用法:
xxx.sh add 增加音量
xxx.sh sub 减少音量
xxx.sh mute 切换静音
阅读(1766) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~