实验目的

  1. 理解shell程序的设计方法
  2. 掌握shell程序编辑、运行、调试方法与过程

实验内容

shell简单编程

实验过程

要求:
1.记录实验过程,对关键过程进行文字说明并附上操作截屏。
2.逻辑清晰、排版美观。

编写shell脚本,实现功能:在用户输入年、月后自动打印出对应年月的日历。

程序代码:

[c@localhost ~]$ mkdir /tmp/test
[c@localhost ~]$ cd /tmp
[c@localhost tmp]$ chmod 751 test
[c@localhost tmp]$ cd test
[c@localhost test]$ mkdir dir1 dir2 dir3
[c@localhost test]$ ls
dir1  dir2  dir3
[c@localhost test]$ chmod 764 dir1 dir2 dir3
[c@localhost test]$ touch file1 file2
[c@localhost test]$ ls
dir1  dir2  dir3  file1  file2
[c@localhost test]$ cd
[c@localhost ~]$ ls -l /tmp/*

运行结果:在这里插入图片描述

Logo

更多推荐