怎么才能有自己的网站,seo外链友情链接,网站 点击量,网站推广途径和要点有哪些一、简介 shell是用户和操作系统交互的命令行解释器。 shell有很多种#xff1a; bash、csh、sh、ksh、、、 我们等了linux时看到的命令行就是一个bash。 二、第一个脚本#xff1a; [rootlinux1 script]# vim first.sh #!/bin/bash#auther:xiaofan#time:2016.10.4#井号是注… 一、简介 shell是用户和操作系统交互的命令行解释器。 shell有很多种 bash、csh、sh、ksh、、、 我们等了linux时看到的命令行就是一个bash。 二、第一个脚本 [rootlinux1 script]# vim first.sh #!/bin/bash#auther:xiaofan#time:2016.10.4#井号是注释echo hello word 执行脚本 方法1 [rootlinux1 script]# bash first.sh hello word [rootlinux1 script]# sh first.sh hello word 方法2[rootlinux1 script]# chmod x first.sh [rootlinux1 script]# ./first.sh hello word 查看脚本执行的过程 [rootlinux1 script]# sh -x first.sh echo hello wordhello word 三、变量 变量分为两大类 局部变量需要自己定义。 环境变量:系统自带的。 变量定义 变量名称变量值 调用自定义变量 [rootlinux1 script]# namexiaofan[rootlinux1 script]# echo my name is $namemy name is xiaofan[rootlinux1 script]# echo my name is $namemy name is xiaofan[rootlinux1 script]# echo my name is $name #注意单引号是不会解释变量的my name is $name 常用的系统变量 [rootlinux1 script]# cat t1.sh #!/bin/bashecho $0 #当前程序名echo $1 #程序的第一个参数echo $* #程序的所有参数名echo $# #当前程序的参数个数echo $? #程序执行的返回状态echo $PATH #系统环境变量的路径echo $PWD #当前目录echo $UID #当前用的id[rootlinux1 script]# sh t1.sh t1 t2t1.sht1t1 t220/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/root/bin/script0 三、脚本输出有颜色的字体 \033[32m 和 \033[0m 之间的字体会变成绿色 \033[32m 和 \033[1m 下面的所有的字体会变成绿色 \033[31m 和 \033[0m 之间的字体会变成红色 转载于:https://www.cnblogs.com/fanxuanhui-linux/p/5931503.html