这是我参与更文挑战的第4天
,活动详情查看更文挑战
#!/bin/bash
while true
do
echo "input path:"
read path
if [ $path = "q" ]
then break
elif [ -d $path ]
then
for file in `ls $path`
do
file=$path/$file
if [ -d $file ]
then echo "${file}_d"
elif [ -b $file ]
then echo "${file}_b"
elif [ -L $file ]
then echo "${file}_|"
elif [ -f $file ]
then echo "${file}_-"
else echo "${file}_c"
fi
done
else echo "illegal input"
fi
done
复制代码
#!/bin/bash
while true
do
echo "Use one of the following options
P:To display current directory
S:To display the name of running file
D:To display today's date and present time(如:2017-04-26 05:45:12)
L:To see the list of files in your present working directory
W:To see who is logged in
I:To see the ip address of this local machine
Q:To quit this program
Enter your option and hit:"
read in
case $in in
P|p) pwd ;;
S|s) echo $0 ;;
D|d) date "+%Y-%m-%d %H:%M:%S";;
L|l) ls ;;
W|w) w ;;
I|i) ip add ;;
Q|q) break ;;
*) echo "!!!!!illegal input!!!!!!!!"
esac
done
复制代码
#!/bin/bash
while true
do
echo "input path:"
read path
if [ $path = "q" ]
then break
elif [ -d $path ]
then
for file in `ls $path`
do
file=$path/$file
if [ -d $file ]
then echo "${file}_d"
elif [ -b $file ]
then echo "${file}_b"
elif [ -L $file ]
then echo "${file}_|"
elif [ -f $file ]
then echo "${file}_-"
else echo "${file}_c"
fi
done
else echo "illegal input"
fi
done
复制代码
#!/bin/bash
function func(){
a=$1
echo -e
until [ $a -eq 0 ]
do
echo -n "$a "
let a=$a-1
done
}
while true
do
echo "please,input a number:"
read b
until [ $b -le 0 ]
do
func $b
let b=$b-1
done
echo -e
done
复制代码
30 8 * * * /home/zkpk/shell/startftp.sh
30 23 * * * systemctl stop vsftpd
50 23 * * * /home/zkpk/shell/tarfile.sh
30 8-23/1 * * * /home/zkpk/shell/pingbaidu.sh
#! /bin/bash
# /home/zkpk/shell/startftp.sh
# 开启vsftpd
systemctl start vsftpd
if [ $? -eq 1 ]; then
echo "start ftp error" | mail -s "error" root
else
ps -ef | grep vsftpd | head -n1 >> /var/ftp/"`date +%Y-%m-%d`".log
fi
#! /bin/bash
# /home/zkpk/shell/pingbaidu.sh
#ping 百度
ping -c 4 www.baidu.com >> /var/ftp/"`date +%Y-%m-%d`".log
#! /bin/bash
# /home/zkpk/shell/tarfile.sh
# 压缩文件
sleep 30s
tar -czvf "`date +%Y-%m-%d`".tar.gz /var/ftp
chmod 400 "`date +%Y-%m-%d`".tar.gz
mv "`date +%Y-%m-%d`".tar.gz /root
rm -rf /var/ftp/*
复制代码
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END