如何在更高的数字长度上显示数字? 这是一个小脚本:
#!/bin/bash
#Increment until proper folder name is found
VarAdd=0
VarDate=$( date +%F )
mkdir -v 2016-01-26-00{0..9} # Testing script
if [ -d /.../"$VarDate-00$VarAdd" ]; then
while [ -d /.../"$VarDate-00$VarAdd" ]; do
(( VarAdd++ ))
done
mkdir -v "$VarDate-00$VarAdd"
fi
我的问题是,在第11个循环中,下一个创建的文件夹将是2016-01-26-0010。如何让它显示为2016-01-26-010? 提前谢谢!
答案 0 :(得分:1)
使用SELECT * FROM students as x
WHERE gwid NOT IN (
SELECT gwid FROM attendance
WHERE date='160126' AND classid = x.classid )
AND x.classid = 'm1100'
填充以格式化字符串:
printf