偶然上了鸟哥的网站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 --------
相关资源:Java 面经手册·小傅哥(公众号:bugstack虫洞栈).pdf