作业 :
一:
ubuntu@ubuntu:~$ cat myfirstshell.sh
#!/bin/bash
echo "出品人:邹彬华 脚本:$0 说明:目的保密"
myuser=`whoami`
echo "Hello $myuser"
hostnam=`hostname`
hom=`pwd`
df=`df -h`
id=`id`
echo "hostname=$hostnam path=$PATH home=$hom 磁盘=$df"
echo "$id"
echo "good bye $myuser"
二、三(合在一个程序里)
ubuntu@ubuntu:~$ cat mysecondshell.sh
#!/bin/bash
name=`whoami`
id=`id|cut -d " " -f "1"`
pwd=`pwd`
echo "name=$name"
echo "$id"
echo "pwd=$pwd"
id10=`head -10 /etc/passwd | tail -1 | cut -d ":" -f "3"`
id20=`head -20 /etc/passwd | tail -1 | cut -d ":" -f "3"`
idhe=$((id10+id20))
echo "10id 与 20id 和: $idhe"
四:
ubuntu@ubuntu:~$ cat mythirdshell.sh
#!/bin/bash
read socd
if [ $socd -le 100 ] && [ $socd -ge 90 ]
then
echo "A"
elif [ $socd -lt 90 -a $socd -ge 80 ]
then
echo "B"
elif [$socd -lt 80 -a $socd -ge 70]
then
echo "C"
elif [$socd -lt 70 -a $socd -ge 60]
then
echo "D"
fi