
1. test.shell脚本内容如下:
#!/bin/bash
name="Mike" # 定义name变量并赋值
echo ${name} # 输出name变量的值
date # 显示当前系统的日期和时间
cd /tmp # 切换到/tmp目录
pwd # 输出当前绝对路径
运行结果如下:
2. 运行脚本:sh test.shell 或者 chmod +x test.shell &&./test.shell # 变为可执行文件
如果帮到你,望采纳~
1、#!/bin/bash
dir=$1
cd $ dir
shift
for f in $@
do
cat $f
done
2、
#!/bin/bash
for file in `ls -1 /root/a | grep ".*.c"`
{
mv /root/a/$file /root/b
}
ls -lS /root/b
3.
@City = qw/Sydney Osaka Beijing........./
for($i=0,i<10i++)
{
echo "$city[i]"
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)