Linux基础09_shellscript练习
2016-04-10 18:06
633 查看
i sh02.sh
#!/bin/bash
# User inputs his first name and last name.
# Program shows his full name.
read -p “Please input yourfirst name:” firstname
read -p “Please input yourlast name:” lastname
echo –e “\n Your full nameis:$firstname$lastname”
vi sh03.sh
#!/bin/bash
让使用者输入文件名称,取得 fileuser 这个变量;
echo -e "I will use'touch' command to create 3 files."
# 提示使用者输入
read -p "Please inputyour filename:" fileuser
#创建日期
filename=${fileuser:-"filename"}
date1=$(date +%Y%m)
date2=$(date +%Y%m)
date3=$(date +%Y%m%d)
file1=${filename}${date1}”08” file2=${filename}${date2}”09”
file3=${filename}${date3}
# 创建文件
touch "$file1"
touch "$file2"
touch "$file3
vi sh04.sh
#!/bin/bash
echo -e "input 2numbers, I cross them! \n"
read -p "first number: "firNum
read -p "second number:"secNum
total=$(($firNum *$secNum))
echo -e " result:$total"
注意:
#!/bin/bash
# User inputs his first name and last name.
# Program shows his full name.
read -p “Please input yourfirst name:” firstname
read -p “Please input yourlast name:” lastname
echo –e “\n Your full nameis:$firstname$lastname”
vi sh03.sh
#!/bin/bash
让使用者输入文件名称,取得 fileuser 这个变量;
echo -e "I will use'touch' command to create 3 files."
# 提示使用者输入
read -p "Please inputyour filename:" fileuser
#创建日期
filename=${fileuser:-"filename"}
date1=$(date +%Y%m)
date2=$(date +%Y%m)
date3=$(date +%Y%m%d)
file1=${filename}${date1}”08” file2=${filename}${date2}”09”
file3=${filename}${date3}
# 创建文件
touch "$file1"
touch "$file2"
touch "$file3
vi sh04.sh
#!/bin/bash
echo -e "input 2numbers, I cross them! \n"
read -p "first number: "firNum
read -p "second number:"secNum
total=$(($firNum *$secNum))
echo -e " result:$total"
注意:
相关文章推荐
- Linux socket 初步
- Linux Kernel 4.0 RC5 发布!
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- Linux 下无损图片压缩小工具介绍