- 25
- 0
- 约2.28千字
- 约 4页
- 2020-01-15 发布于江苏
- 举报
上机实习题:
1. 用 Shell 编程,判断一文件是不是字符设备文件,如果是将其拷贝到 /dev 目录下。 a
#!/bin/bash
directory=/dev
for file in /bin/a2p
do
if [ -f $file ]
then
cp $file $directory/$file.bak
Fi
done
编写一个 shell 脚本,完成功能: 1 )显示文字“Waiting for a while,. ”
2)长格式显示当前目录下面的文件和目录,并输出重 定向到
/home/file.txt 文件 3 )定义一个变量,名为 s ,初始值“ Hello ” 4 )
使该变量输出重定向到 /home/string.txt 文件 m
#!/bin/bash
echo waiting for a while ?
ls -l./home/file.txt
s=hello
echo $s /home/string.txt
编写一个 shell 脚本,它把第二个位置参数及其以后的 各个参数指定的文件复制到第一个位置参数指定的目录 中。 b
#!/bin/bash
dir=$1
shift
while [$1]
do
file=$1
cp $1 $dir
shift
done
ls $dir
编写一个 shell 脚本,利用 for 循环将当前目录下
您可能关注的文档
- 1信息服务业务(仅限互联网信息服务)发展和实施计划专用表格1.docx
- 2018年度机修车间安全生产培训计划.docx
- 2018文明礼仪教育实施方案.docx
- 7设计和开发控制程序.docx
- 89c51单片机c语言编写的pwm程序.docx
- 8086汇编语言程序设计实验指导书.docx
- c++数组指针题(含答案).docx
- c++程序设计电子宠物.docx
- b2c跨境电商题目.docx
- c程序设计作业(5).docx
- 全文可编辑培训课件-机构研究报告-德国数字音乐用户分析报告:deezer -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国退休用户分析报告-外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国洗衣机用户分析报告:candy -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国新闻日报用户分析报告:koelner stadt anzeiger-外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国新闻日报用户分析报告:westdeutsche allgemeine zeitung leserinnen -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国移动运营商用户(联通)分析报告:alditalk -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国移动运营商用户(联通,电信)分析报告:alditalk -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国数字音乐用户分析报告:apple music itunes -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国洗衣机用户分析报告:beko -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国洗衣机用户分析报告:miele -外文培训课件.pptx
原创力文档

文档评论(0)