一、实验目的和要求
1 了解什么是脚本
2 掌握shell编程方法
3 掌握makefile的编写规则
二、实验内容和原理
1 编写一个Shell脚本,要求:显示当前目录的所有内容,并统计可执行文件(.sh)的数量,将统计结果输入到指定的文件当中;
2 编写一个Shell脚本,要求:
2.1 在屏幕上显示一行提示信息
2.2 读入一行命令
2.3 判断此命令是否为“exit”,若是则退出
2.4 如果不是,分析并执行这行命令
3 假定一个程序由以下5个文件组成,其源代码如下,请编写一个Makefile文件,并运行。
文件1:main.c
#include “mytool1.h”
#include “mytool2.h”
int main()
{ mytool1_print(“hello mytool1!”);
mytool2_print(“hello mytool2!”);
return 0;
}
文件2:mytool1.c
#include “mytool1.h”
#include <stdio.h>
void mytool1_print(char *print_str)
{
printf("This is mytool1 print : %s ",print_str);
}
文件3:mytool1.h
#ifndef _MYTOOL_1_H
#define _MYTOOL_1_H
void mytool1_print(char *print_str);
#