否不等。
答案:N
()4.在根文件系统中,存放系统配置文件的目录为/temp。
答案:N
()5.动态库在程序编译时并不会被连接到目标代码中,而是在程序运行是才被载入。
答案:Y
()6.编译规则文件名有三种,依次为:GNUMakefile、Makefile、makeFile。
答案:N
()7.gcc编译命令参数中–c 参数用于指定只进行到编译结束,不进行链接。
答案:Y
()8.shell脚本中,可以使用[ -d aaa ]来测试aaa是否为文件。
答案:N
()9. /sbin 目录存放用户使用的shell命令
答案:N
()10. 软链接的文件类型位是-
答案:N
五、简答题简答2题,共10分
1.写出下列目录中存放的都是哪类文件?
/usr
/bin
/home
2.符号链接与硬链接的区别是什么?
六、编程题(两题共25分,第1题10分;第2题15分)
1. 编写shell程序,实现自动删除50个账号的功能。账号名为stud1至stud50。
2.程序补全
/*头文件略*/
int main(void)
{ i nt fd,size,len;
char *buf="Hello! I'm writing to this file!";
char buf_r[10];
len = strlen(buf);
/*首先调用open函数,并指定打开文件/tmp/hello 没有就创建,可读可写权限为666 */
if((fd = 1 )<0){
perror("open:"); exit(1); }
/*调用write函数,将buf中的内容写入到打开的文件中*/
If((size = 2 ) < 0){
perror("write:"); exit(1); }
else
printf("Write:%s\n",buf);
/*调用lsseek函数将文件指针移到文件起始*/
3 ;
/*读出文件中的10个字节*/
if((size = 4 )<0){
perror("read:"); exit(1); }
else
printf("read form file:%s\n",buf_r);
/*关闭文件描述符*/
if( 5 < 0 ){
perror("close:"); exit(1); }
else
printf("Close hello.c\n");
exit(0);
}
1.
2.
3.
4.
5.
Page 3 of 4