A quick way to prevent execution is to enter the comment character #, and then insert the command.
I often do this because I'm a fat finger when copying and capturing extraneous characters.
When you paste after the comment symbol, the command is in the history buffer and you can edit, uncomment and run it.
--- reply to comment
You are right, this only works for single-line commands. If the clipboard is multi-line, you can transfer the clipboard data through sed.
Stupid bash trick number 4 million and one:
prompt:$ xclip -o -selection clipboard | sed --regexp-extended 's/^(.*)$/# \1;/'
will do the following:
for i in *.JPG;
do echo mv $i ${i/.JPG/.jpg};
done;
in it:
# for i in *.JPG;
# do echo mv $i ${i/.JPG/.jpg};
# done;
Which is really not worth the effort, but a curious pleasure; >
Ron ruble
source share