Linux Shell试用

偶然上了鸟哥的网站http://linux.vbird.org/,看到了SHELL一章,尝试着写了一个计算器的小脚本:

kinkcalc:

# my first linux shell
echo '-------- count start -------- '
read -p 'exp:' exp
echo 'value:'$(($exp))
echo '-------- count end -------- '

 

拷贝到/usr/sbin下:

kinkding@kinkding-desktop:~$ sudo su
root@kinkding-desktop:/home/kinkding# cp /home/kinkding/dev/shell_learn/kinkcalc /usr/sbin/

 

运行效果如下:

kinkding@kinkding-desktop:~$ kinkcalc 
-------- count start -------- 
exp:2+3*4/2-(44/2)
value:-14
-------- count end -------- 

 

你可能感兴趣的:(linux,脚本)