我一直在网上寻找,但没有找到解决方案(很难知道要搜索什么)。我想要一种在输入上显示“当前值”的方法。类似于read -e -p "something: " -i "this" $variable
Busybox sh 中的内容。由于该选项仅在 Bash4 中可用,这不是默认选项。我将不得不以另一种方式解决它。不确定这是否可能..
read -p "Select by entering an number: " ANS
case $ANS in
1 ) ANS="%R | %a %d %b" ;;
2 ) ANS="%R, %a %d %b" ;;
3 ) read -p "Enter a custom string (ex. %R): " ANS ;;
4 ) ANS="%R" ;;
* ) read -p "Just answer with a number between 1 to 4. Aborting!" end; exit 0 ;;
esac
我想要的是案例#3 将显示文件的当前值。前任。如果文件有 %R 作为当前值。然后这就是我希望它在输入上显示的内容,以便用户以交互方式更改它。