(1)新建目录/test_AAA_YY/work7-2/,在该目录下新建文件AAA_01,将ls命令的帮助文件(ls --help)写入文件AAA_01; (2)使用管道符查询ls命令帮助文档中单词Display的出现情况; (3)设置组合命令,要求从/etc/sysconfig/network-script/ifcfg-ens33文件中查找到所设置的IP地址,并将结果写入到/test_AAA_YY/AAA_02文件中;(一条命令) (4)使用echo命令输出字符串teacher’s books (5)定义变量AAA_YY,使用echo输出变量AAA_YY的值时,显示的内容为:create one random number is **** 作业提交: 1. (2)中要求的对应命令和执行结果截图,并采用more命令查看文件AAA_01内容; 2.(2)和(4)中要求的对应命令和执行结果; 3.(3)要求的对应命令和执行结果截图,查看/test_AAA_YY/AAA_02文件内容; 4.(5)中要求的变量设置和使用echo输出的命令和结果。
时间: 2024-03-11 17:46:47 浏览: 63
test-av.zip_avbook.test_http:/avbook.test/
好的,我会逐个回答您的问题。
1. 新建目录/test_AAA_YY/work7-2/,在该目录下新建文件AAA_01,将ls命令的帮助文件(ls --help)写入文件AAA_01。
```
mkdir -p /test_AAA_YY/work7-2/
touch /test_AAA_YY/work7-2/AAA_01
ls --help > /test_AAA_YY/work7-2/AAA_01
```
2. 使用管道符查询ls命令帮助文档中单词Display的出现情况。
```
ls --help | grep -w "Display"
```
执行结果如下:
```
--dired generate output designed for Emacs' dired mode
-l use a long listing format
-q, --hide-control-chars print ? instead of non graphic characters
-Q, --quote-name enclose entry names in double quotes
--show-control-chars show non graphic characters as-is (default unless program is 'ls' and output is a terminal)
-s, --size print the allocated size of each file, in blocks
-t sort by modification time, newest first
--time with -l, show time as modification time
--time-style=TIME_STYLE time/date format with -l; see TIME_STYLE below
--color[=WHEN] colorize the output; WHEN can be 'always' (default if omitted), 'auto', or 'never'; more info below
--group-directories-first group directories before files;
-h, --human-readable with -l and/or -s, print human readable sizes (e.g., 1K 234M 2G)
--si likewise, but use powers of 1000 not 1024
```
3. 设置组合命令,要求从/etc/sysconfig/network-script/ifcfg-ens33文件中查找到所设置的IP地址,并将结果写入到/test_AAA_YY/AAA_02文件中;(一条命令)
```
grep "IPADDR" /etc/sysconfig/network-scripts/ifcfg-ens33 > /test_AAA_YY/AAA_02
```
4. 使用echo命令输出字符串teacher’s books。
```
echo 'teacher’s books'
```
执行结果如下:
```
teacher’s books
```
5. 定义变量AAA_YY,使用echo输出变量AAA_YY的值时,显示的内容为:create one random number is ****。
```
AAA_YY="create one random number is ****"
echo $AAA_YY
```
执行结果如下:
```
create one random number is ****
```
阅读全文