Is there a utility that always prompts the user for confirmation before executing a command similar to the way sudo asks for password?
|
|
|||
|
Do you want it to work without typing an extra command, e.g.
Or only when the user types something like
Or only when the user tries to run certain commands, e.g.
but not for
If option 1, that can be done using the preexec hook in zsh, or the DEBUG trap in bash. If option 2, put something like this in
If option 3, you could modify the |
||||
|
|
|
I have played with bash a bit and figured out a hack by which this could be made possible.
You can save this script under, say, Please note that this is nothing more than a proof-of-concept hack; I doubt it can really be any useful in this form. If you will have to confirm each and every command you type, you will very soon acquire a habit to automatically hit "yes" after each command. Your mental mapping for "end of command" will change from just Enter to Enter,yes,Enter - you will be typing it as a whole, don't even trying to spend some time on verifying that you really want this command to execute. This is counterproductive and won't help you. |
||||
|
|
cdandls? – Carsten Thiel Jan 19 '11 at 8:16