Pre-filling a prompt in Bash

前端 未结 2 1025
后悔当初
后悔当初 2021-01-18 05:30

Writing a bash script, and I want to get user input. Awesome,

read -p \"What directory should we save in? \" -e FOLDER

Except that what I\'

2条回答
  •  太阳男子
    2021-01-18 06:24

    You can wrap the command in rlwrap, which provides instant readline capabilities: http://utopia.knoware.nl/~hlub/rlwrap/#rlwrap

    (rlwrap -P does what you want)

    As far as a pure bash solution is concerned for the 3.2 line (which i am presuming you are using), I dont think its possible

提交回复
热议问题