解决方法
你不能,但你可以使用一个文件来做到这一点
#!/bin/sh # if we don't have a file,start at zero if [ ! -f "/tmp/value.dat" ] ; then value=0 # otherwise read the value from the file else value=`cat /tmp/value.dat` fi # increment the value value=`expr ${value} + 1` # show it to the user echo "value: ${value}" # and save it for next time echo "${value}" > /tmp/value.dat