ask and confirm
Here are some fun commands for user interactivity in the shell. You can use these as part of a recipe or a nice "one-liner".
ask
The ask
command is similar to the ask()
method in Task Runners. It requires an interactive terminal and will ask the user a question and return their answer. It is meant to be changed with other commands.
or with default values
or with masked input
Or fun stuff like this
confirm
The confirm
command will ask the user a yes/no question and return a passing or failing exit code from the command based on the answer.
Remember the &&
operator will only execute the second command if the first command returns an exit code of 0
.
Last updated