
linux试题 在线求答案
1.编一个脚本,若用户输入a,则将接下来的输入的两个整数相加并输出结果,若输入b,将文件file中的内容发送给用户user1,输入c,显示file的文件类型.要求写出以上...
1.编一个脚本,若用户输入a,则将接下来的输入的两个整数相加并输出结果,若输入b,将文件file中的内容发送给用户user1,输入c,显示file的文件类型.
要求写出以上各功能的具体代码
2.分析指令结果
a. at 10:00 2010-12-31
at>top -b -n -d 3</home/user/toplog
at> <EOT>
b. cat /etc/shadow 丨tee -a ~/teefile 丨wc -l
c. tar -zxvf tools.tar.gz
在线等答案 展开
要求写出以上各功能的具体代码
2.分析指令结果
a. at 10:00 2010-12-31
at>top -b -n -d 3</home/user/toplog
at> <EOT>
b. cat /etc/shadow 丨tee -a ~/teefile 丨wc -l
c. tar -zxvf tools.tar.gz
在线等答案 展开
展开全部
1. #!/bin/bash
read T;
if [ "$T" == "a" ]
then
read num1;
read num2;
echo "$num1 + $num2 = $(($num1+$num2))"
elif [ "$T" == "b" ]
then
cat file |write user1
elif [ "$T" == "c" ]
then
if [ -f file ]; then
echo "file is a file"
fi
if [ -d file ]; then
echo "file is a directory"
fi
if [ -b file ]; then
echo "file is a block dev"
fi
else
echo "invalid input";
exit 1;
fi
2.
a.
b. 将/etc/shadow文件追加到teefile文件中,并在屏幕显示shadow文件的行数
c 。将tool.tar.gz 文件解压缩
read T;
if [ "$T" == "a" ]
then
read num1;
read num2;
echo "$num1 + $num2 = $(($num1+$num2))"
elif [ "$T" == "b" ]
then
cat file |write user1
elif [ "$T" == "c" ]
then
if [ -f file ]; then
echo "file is a file"
fi
if [ -d file ]; then
echo "file is a directory"
fi
if [ -b file ]; then
echo "file is a block dev"
fi
else
echo "invalid input";
exit 1;
fi
2.
a.
b. 将/etc/shadow文件追加到teefile文件中,并在屏幕显示shadow文件的行数
c 。将tool.tar.gz 文件解压缩
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询