shell脚本第二篇--将指定目录下大于200K的文件移动到/tmp下 # vim /tmp/files.sh #!/bin/bash #将指定目录下大于200K的文件移动到/tmp下 read -p "请输入您要将目录下大于200K文件移动的目录路径:" $1 for FILE in `ls $1` do if [ -f $FILE ] ; then if [ `ls -l $FILE | awk `{print $5}` -gt 204800 ] ; then mv $
#!/bin/bash # # Judging the element is a file or a folder if [ $# -lt 1 ];then echo "ERROE!! Usage: ckfile.sh ARGS1 [ARGS2...]" exit 4 fi for i in `seq 1 $#` do if [ -f $1 ];then echo $1 is a commom file elif [ -d $1 ];then echo $1 is a
前两天由于要查一个数据库的binlog日志,经常用命令写比较麻烦,想着写一个简单的脚本,自动去刷一下数据库的binlog日志,就直接在windows上面写了,然后拷贝到linux中去运行,其实很简单的脚本,具体如下: #!/bin/bash #flush mysql logs every day BASEDIR="/usr/local/mysql" echo $BASEDIR BIN="$BASEDIR/bin" echo $BIN MYSQL="$BIN