Shell
批量移动
mv `find ./TheEconomist2021-main/ -name \*.epub ` ./
如果存在
if [ ! -d "$Year_dir" ]; then
mkdir $Year_dir
fi
if [ ! -f "/data/filename" ];then
echo "文件不存在"
else
rm -f /data/filename
fi
批量kill
ps -ef | grep firefox
kill `pgrep Adobe`
请求输入
#! /bin/bash
read -p "Enter your name, please: " username
read -p "Enter your email, please: " email
read -p "Are you sure to continue? [y/n] " input
case $input in
[yY]*)
echo "Your name is $username"
echo "Your email is $email"
;;
[nN]*)
exit
;;
*)
echo "Just enter y or n, please."
exit
;;
esac
进入 root
sudo -i