测试
2022/1/4 23:15:40
本文主要是介绍测试,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
目录- HW 1
- 1.Create a new directory called missing under /tmp;
- 2.Look up the touch program. The man program is your friend.
- 3.Use touch to create a new file called semester in missing.
- 4.Write the following into that file, one line at a time:
- 5.Try to execute the file. Understand why it doesn’t work.
- 6.Run the command by explicitly starting the sh interpreter.
- 7.Look up the chmod program
- 8.Use chmod to make it possible to run the command ./semester.
- 9.Use | and > to write the “last modified”date output by semester into a file called last-modified.txt in your home directory.
HW 1
1.Create a new directory called missing under /tmp;
mkdir /tmp/missing
检验:
2.Look up the touch program. The man program is your friend.
man touch
结果:
3.Use touch to create a new file called semester in missing.
touch /tmp/missing/semester
4.Write the following into that file, one line at a time:
echo '#!/bin/sh' > /tmp/missing/semester echo 'curl --head --silent https://github.com/siyuanluo' >> /tmp/missing/semester
单引号字符串非转义
检验:
vim /tmp/missing/semester
5.Try to execute the file. Understand why it doesn’t work.
./semester ls -l
结果:
users的权限是-rw, 第一组, 没有执行权限x
6.Run the command by explicitly starting the sh interpreter.
sh semester
结果:
解释: OS会通过sh
命令的调用直接产生一个新的Shell进程,并将semester
当作命令行参数传进去。新的Shell进程就会读取、解释并执行该脚本,而OS不关心该文件到底是什么,自然也就不要求可执行权限,只要求读权限就可以了
7.Look up the chmod program
man chmod
太长头疼, 还是这个吧: Linux chmod 命令 | 菜鸟教程 (runoob.com)
8.Use chmod to make it possible to run the command ./semester.
chmod 744 semester ./semester
给用户开权限x, 顺序是rwx, 全开就是111(2)->7
9.Use | and > to write the “last modified”date output by semester into a file called last-modified.txt in your home directory.
最后一问有点不太会... 哪个是last-modified time... output里面没找到啊
这篇关于测试的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-01后台管理开发学习:新手入门指南
- 2024-11-01后台管理系统开发学习:新手入门教程
- 2024-11-01后台开发学习:从入门到实践的简单教程
- 2024-11-01后台综合解决方案学习:从入门到初级实战教程
- 2024-11-01接口模块封装学习入门教程
- 2024-11-01请求动作封装学习:新手入门教程
- 2024-11-01登录鉴权入门:新手必读指南
- 2024-11-01动态面包屑入门:轻松掌握导航设计技巧
- 2024-11-01动态权限入门:新手必读指南
- 2024-11-01动态主题处理入门:新手必读指南