shell-set-shift

本文介绍并演示了Shell脚本的基本语法和常用命令,包括日期操作、循环结构及参数传递,通过实例展示了如何使用Shell脚本来实现特定任务。
#!/bin/sh
echo the date is $(date)
set $(date)
echo the month is $2
#[Output]
the date is Fri Jul 11 15:38:04 CST 2014
the month is Jul

#!/bin/sh
while [ "$1" != "" ] ;do 
	echo $1
	shift
done
exit 0
#[Output]
@ubuntu:~/Desktop/workspace/shell$ ./temptest  aaa bbb ccc
aaa
bbb
ccc


以下要做代码评审,请支持代码的问题 #!/bin/sh local power_mode=$1 if [ "$power_mode" == "strong" ]; then ## thermal #/etc/init.d/thermal restart echo "============now switch to strong mode===========" > /dev/console thermaltool -i wifi0 -set -dc 100 -lo0 -100 -hi0 110 -off0 0 thermaltool -i wifi0 -set -dc 100 -lo1 110 -hi1 113 -off1 30 thermaltool -i wifi1 -set -dc 100 -lo0 -100 -hi0 110 -off0 0 thermaltool -i wifi1 -set -dc 100 -lo1 110 -hi1 113 -off1 30 thermaltool -i wifi2 -set -dc 100 -lo0 -100 -hi0 110 -off0 0 thermaltool -i wifi2 -set -dc 100 -lo1 110 -hi1 113 -off1 30 elif [ "$power_mode" == "medium" ]; then ## thermal echo "============now switch to medium mode===========" > /dev/console thermaltool -i wifi0 -set -dc 100 -lo0 -100 -hi0 110 -off0 30 thermaltool -i wifi1 -set -dc 100 -lo0 -100 -hi0 110 -off0 30 thermaltool -i wifi2 -set -dc 100 -lo0 -100 -hi0 110 -off0 30 elif [ "$power_mode" == "weak" ]; then ## thermal echo "============now switch to weak mode===========" > /dev/console thermaltool -i wifi0 -set -dc 100 -lo0 -100 -hi0 110 -off0 50 thermaltool -i wifi0 -set -dc 100 -lo1 110 -hi1 113 -off1 50 thermaltool -i wifi1 -set -dc 100 -lo0 -100 -hi0 110 -off0 50 thermaltool -i wifi1 -set -dc 100 -lo1 110 -hi1 113 -off1 50 thermaltool -i wifi2 -set -dc 100 -lo0 -100 -hi0 110 -off0 50 thermaltool -i wifi2 -set -dc 100 -lo1 110 -hi1 113 -off1 50 else echo "unsupported power mode type" > /dev/console fi thermaltool -i wifi0 -get > /dev/console thermaltool -i wifi1 -get > /dev/console thermaltool -i wifi2 -get > /dev/console
最新发布
11-14
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值