赞
踩
[root@localhost ~]# echo "hello world"
hello world
[root@localhost ~]# mkdir test
[root@localhost ~]# cd test/
[root@localhost test]# echo aaa >>1.txt
[root@localhost test]# cat !$
cat a.txt
aaa
[root@localhost test]# echo bbb > a.txt
[root@localhost test]# cat !$
cat a.txt
bbb
[root@localhost test]# echo zhangsan;echo lisi
zhangsan
lisi
[root@localhost test]# echo -n zhangsan;echo lisi
zhangsanlisi
不加-n参数,就会换行;加-n参数,两条命令就在同一行
[root@localhost test]# name=laowang
[root@localhost test]# echo $name
laowang
[root@localhost ~]# echo "i am lisi\thelloworld"
i am lisi\thelloworld
[root@localhost ~]# echo -e "i am lisi\thelloworld"
i am lisi helloworld
[root@localhost test]# ping -c2 wwww.baidu.com PING ps_other.a.shifen.com (39.156.66.10) 56(84) bytes of data. 64 bytes from 39.156.66.10 (39.156.66.10): icmp_seq=1 ttl=128 time=27.8 ms 64 bytes from 39.156.66.10 (39.156.66.10): icmp_seq=2 ttl=128 time=27.9 ms --- ps_other.a.shifen.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1005ms rtt min/avg/max/mdev = 27.835/27.872/27.910/0.171 ms [root@localhost test]# echo $? 0 //结果为0证明执行成功 [root@localhost test]# ping -c2 192.18.156.22 PING 192.18.156.22 (192.18.156.22) 56(84) bytes of data. --- 192.18.156.22 ping statistics --- 2 packets transmitted, 0 received, 100% packet loss, time 999ms [root@localhost test]# echo $? 1 //结果不是0证明执行失败
需求:
写一个宝塔清单列表
1.定义一个脚本,以.sh结尾
2.输出以下内容,供用户选择
请从以下选项中,选出你要进行的操纵:
1.安装apache
2.安装MySQL
3.安装php
4.安装LAMP
5.安装wordpreess
[root@localhost ~]# vim 1.sh
#!/bin/bash
echo "请从以下选项中,选出你要进行的操纵:"
echo "1.安装apache"
echo "2.安装MySQL"
echo "3.安装php"
echo "4.安装wordpress"
[root@localhost ~]# chmod +x 1.sh
[root@localhost ~]# ./1.sh
请从以下选项中,选出你要进行的操纵:
1.安装apache
2.安装MySQL
3.安装php
4.安装wordpress
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。