当前位置: 技术问答>linux和unix
谁帮我写一下下面这几个简单的Shell命令.马上给分!
来源: 互联网 发布时间:2015-10-18
本文导语: root program pascal p1.pas p2.pas old.txt system w1.c w2.c ...
root
program pascal p1.pas
p2.pas
old.txt
system w1.c
w2.c
w3.c
document t1.txt
t2.txt
1. 对于上面的文件目录结构,假定全部在根目录下操作,用UNIX系统的shell命令语言编写一个shell文件,文件名为a1.txt,完成如下操作:
1).在program目录下建立一个新目录TC
2).将w1.c w2.c w3.c 三个文件拷贝到TC目录下
3).删除system目录。
4).将文件old.txt改名为new.txt
5)分屏查看文本文件t1.txt的内容
6)把命令ls列出的program目录下的目录清单保留到名为t1.txt的文件末尾去而不在屏幕上显示,不能破坏文件原有的内容。
7)用命令把t1.txt文件打印输出。
8) 删除t2.txt文件。
program pascal p1.pas
p2.pas
old.txt
system w1.c
w2.c
w3.c
document t1.txt
t2.txt
1. 对于上面的文件目录结构,假定全部在根目录下操作,用UNIX系统的shell命令语言编写一个shell文件,文件名为a1.txt,完成如下操作:
1).在program目录下建立一个新目录TC
2).将w1.c w2.c w3.c 三个文件拷贝到TC目录下
3).删除system目录。
4).将文件old.txt改名为new.txt
5)分屏查看文本文件t1.txt的内容
6)把命令ls列出的program目录下的目录清单保留到名为t1.txt的文件末尾去而不在屏幕上显示,不能破坏文件原有的内容。
7)用命令把t1.txt文件打印输出。
8) 删除t2.txt文件。
|
#vi a1.txt
#!/bin/bash
mkdir /root/program/TC
cp /system/w1.c /root/program/TC
cp /system/w2.c /root/program/TC
cp /system/w3.c /root/program/TC
rm -rf /system
mv /root/program/old.txt /root/program/new.txt
cat /document/t1.txt | more
ls /root/program/ >> /document/a1.txt
lp /documnet/t1.txt
rm -rf /document/t2.txt
保存退出
#sh a1.txt
#!/bin/bash
mkdir /root/program/TC
cp /system/w1.c /root/program/TC
cp /system/w2.c /root/program/TC
cp /system/w3.c /root/program/TC
rm -rf /system
mv /root/program/old.txt /root/program/new.txt
cat /document/t1.txt | more
ls /root/program/ >> /document/a1.txt
lp /documnet/t1.txt
rm -rf /document/t2.txt
保存退出
#sh a1.txt