shell1.sh
#!/bin/bash
#shell5
if test -w $1
then echo "writeable"
else
echo "unwriteable"
fi
if test -r $1
then echo "readable"
else
echo "unreadable"
fi
if test -x $1
then echo "excuteable"
else
echo "unexcuteable"
fi
usb.sh
#!/bin/bash
#usb
echo "Welcome to use AUTOUSB"
echo "do you want to load the usb(y/n)"
read ANSWER
if [ $ANSWER = Y -o $ANSWER =y]
then mount -t vfat/dev/sdal/mnt/usb
echo "do you want copy the file to /home/limao/dazhi(y/n)"
read ANSWER
while [ $ANSWER=y -o $ANSWER=Y ]
do
ls -a /mnt/usb
echo "type the filename you want to copy"
read FILE
cp $FILE /home/limao/dazhi
if [ $? = 0]
then
echo "copy finish"
else
echo "copy errored"
fi
echo "any another files(y/n)"
read ANSWER
done
fi
echo "do you want to copy the file to usb(y/n)"
read ANSWER
while [ $ANSWER=y -o $ANSWER=y]
do
ls -a /home/limao/dazhi
echo "type the filename want to copy to usb "
read FILE
cp "/home/limao/dazhi" /mnt/usb
if [ $? = 0]
then
echo "copy file finished"
else
echo "copy file errored"
fi
echo "any otherfiles(y/n)"
read ANSWER
done
echo "do you want to umount usb (y/n)"
read ANSWER
if [ $ANSWER=y -o $ANSWER=Y ]
then
umount /mnt/usb
else
echo "Haven't umount!"
fi
echo "Goodbye"
shell2.sh
#!/bin/bash
#shell8
for i in 1 2 3 4 5 6 7 8 9
do
for j in 1 2 3 4 5 6 7 8 9
do
if test $i -ge $j
then
echo -e "$j * $i = \c"
echo -e "$[ $j*$i ]\c"
echo -e "\t\c"
fi
done
echo ""
done
shell3.sh
#!/bin/bash
#shell9
sum=0
count=0
until [ $count -gt 100 ]
do
sum=$[$sum+$count]
count=$[$count+1]
done
echo "count $count"
echo "sum $sum"
signal.sh
#!/bin/sh
trap 'rm -f ./my_temp_$$' INT
echo creating file ./my_temp_$$
date > ./my_temp_$$
echo "press interrupt to interrupt ..."
while [ -f ./my_temp_$$ ] ; do
echo FILE EXIS
sleep 1
done
trap INT
echo creating...
date > ./my_temp_$$
echo "press the interrupt..."
while [ -f ./my_temp_$$ ] ;do
echo EXIT
sleep 1
done
echo we wewewe