In Bash, how to add “Are you sure [Y/n]” to any command or alias?

These are more compact and versatile forms of Hamish’s answer. They handle any mixture of upper and lower case letters: read -r -p “Are you sure? [y/N] ” response case “$response” in [yY][eE][sS]|[yY]) do_something ;; *) do_something_else ;; esac Or, for Bash >= version 3.2: read -r -p “Are you sure? [y/N] ” response if … Read more

jQuery modal dialog and jqGrid

The following code could do what you need $(“#wics”).click( function(){ var grid = jQuery(“#list10”); var ids = grid.jqGrid(‘getGridParam’,’selarrrow’); if (ids.length>0) { var names = []; for (var i=0, il=ids.length; i < il; i++) { var name = grid.jqGrid(‘getCell’, ids[i], ‘Name’); names.push(name); } //alert (“Names: ” + names.join(“, “) + “; ids: ” + ids.join(“, “)); … Read more