How to get user confirmation in fish shell?
问题 I'm trying to gather user input in a fish shellscript, particularly of the following oft-seen form: This command will delete some files. Proceed (y/N)? After some searching around, I am still not sure how to do this cleanly. Is these a special way of doing this in fish? 回答1: The best way I know of is to use the builtin read . If you are using this in multiple places you could create this helper function: function read_confirm while true read -l -P 'Do you want to continue? [y/N] ' confirm