【发布时间】:2020-06-19 03:53:52
【问题描述】:
请看下面的shell脚本:
#!/bin/bash
echo "Enter the date in (YYYY-MM-DD) format: "
read dt
i=00
echo "/opt/log-$dt_$i"
预期输出:
Enter the date in (YYYY-MM-DD) format:
2020-06-18
/opt/log-2020-06-18_00
但得到以下输出:
Enter the date in (YYYY-MM-DD) format:
2020-06-18
/opt/log-00
请推荐?
【问题讨论】:
-
shellcheck.net 会为您指明正确的方向。