按关键词阅读: Linux考试试题 Linux题
2.有一普通用户想在每周日凌晨零点零分定期备份/use 。
50、r/backup到/tmp目录下 , 该用户应如何做? 参考答案:(1)第一种方法:用户应使用crontab e 命令创建crontab文件 。
格式如下:0 0 * * sun cp r /user/backup /tmp(2)第二种方法:用户先在自己目录下新建文件file , 文件内容如下:0 * * sun cp r /user/backup /tmp然后执行 crontab file 使生效 。
3.写一个shell 脚本 , 检查给出的串是否为回文(palindrome) 。
参考程序:#! /bin/bashecho Enter stringread strlen=echo $str | wc -clen=expr $len - 1l=expr $len / 2ctr=1flag=0while test $ctr -le $ldoa=echo $str | cut -c$ctrb=echo $str | cut -c$lenif test $a -ne $bthen flag=1breakfictr=expr $ctr + 1len=expr $len - 1doneif test $flag -eq 0then echo String is palindromeelse echo String not a palindromefi河北工业大学期末考试试卷一、填 。
来源:(未知)
【学习资料】网址:/a/2021/0121/0021123991.html
标题:期末考试试题8套|Linux期末考试试题8套含答案( 七 )