linux脚本学习小记(1)
1.输出信息
#!/bin/bash
# Program:
# This program is used to show "Hello World!" in screen
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH
echo -e "Hello World! \a \n"
exit 0
结果:
2.请用户输入两个数,计算两个数的成绩
#!/bin/bash
# Program:
# User can input 2 integer to cross by!
# History:
# 2005/08/23 lyc first release
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin/local/sbin:~/bin
export PATH
echo -e "You should input 2 number, I will corss them!\n"
read -p "first number: " firstnu
read -p "second number: " secondsu
total=$(($firstnu*secondsu))
echo -e "\nThe number $firstnu x $secondsu is ==> $total"
其中,PATH给出的是多个bin文件路径,各路径间以":"分开。
结果:
本文介绍了使用Linux脚本进行基本操作的方法,包括输出信息和计算两个数的乘积。
84

被折叠的 条评论
为什么被折叠?



