shell 脚本传参数

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yan88888888888888888/article/details/86555648

用$1 $2等接收参数 

currentday=$1;
goaluser=$2;
if [ -z $currentday ]; then
  currentday=`date -d "1 day ago" +"%Y%m%d"`
fi
if [ -z $goaluser ]; then
  goaluser=1000000;
fi
echo $currentday $goaluser;

 分别执行 

sh xx.sh

20190118 1000000

sh xx.sh 20200202 

20200202 1000000

sh xx.sh 20200202  990000

20200202  990000

猜你喜欢

转载自blog.csdn.net/yan88888888888888888/article/details/86555648