Show the command before execution and execute only after enter

Often I copy paste command from text editor to shell.

Is there any way to show the command(after pasting) and to execute only after pressing enter.

This way I can see the command first before execution and avoid problematic situations.

maybe another way to ask the same question is:
Is there configuration in bash to stop executing command on encountering newline and execute on manual newline by user ?

Answer

type a quote ' or " char before pasting.

if the line looks good, jump to the beginning (something like HOME or CTRL+a) and DEL the quote char and hit enter. Hit CTRL+c to throw away the entire multi-line paste.

If there are quote chars of the same kind in the clipboard when you paste, that will be a problem with this process.

Attribution
Source : Link , Question Author : kumar , Answer Author : JohnnyB

Leave a Comment