How can I prevent or interrupt accidental copy/paste in the terminal?

239

Solution 1

To safely paste, you could invoke a text editor in bash using CTRL + X / E. The shell builtin fc will bring up an editor with the last command.

Short of killing the shell/terminal, I am not sure if there is any way to kill something after you have pasted something in, and it has gone wrong.

Solution 2

Using urxvt makes this very easy. Simply enable confirm-paste in your .Xresources.

URxvt.perl-ext-common: confirm-paste,

I think it comes with certain packages of urxvt or urxvt perls... But once enabled it will ask you to hit y or n on paste of primary or selection buffers, and display a line count. So if you see a million lines you can just quickly hit n and be done with it.

Share:
239
Francis
Author by

Francis

Updated on September 18, 2022

Comments

  • Francis
    Francis over 1 year

    I already have a script that is working in with one click, first unzip and second execute the setup.

    Dim objShell
    Set objShell = WScript.CreateObject( "WScript.Shell" )
    objShell.Run("7z.exe x temp.7z")
    wscript.sleep (3000)
    objShell.Run("/temp/setup1.exe")
    

    Now I need to modify the script to have different setup take from user input

    I have setup1.exe, setup2.exe, setup3.exe, it depend user select the option 1,2 or 3 but the unzip command is must and one time.

    I have script take user input and run command with it but not meet the requirement, please help.

    strInput = InputBox("prompt")
    Dim oShell
    Set oShell = WScript.CreateObject ("WScript.Shell")
    oShell.Run "cmd /K net user " & strInput & "" 
    Set oShell = Nothing
    
    • haimg
      haimg over 12 years
      I break a cold sweat every time it happens to me... Don't work under root and have backups. I also use a "scrap" file in a text editor to test what I copied from a web site, since with browsers you can never be sure what exactly you just copied.
    • 404
      404 over 8 years
      What about it does not meet the requirement? Also what are you expecting to happen with oShell.Run "cmd /K net user " & strInput & ""?
    • Admin
      Admin over 8 years
      Windows comes with a setup program that you can use and do everything you want via a wizard. Type iexpress in Run (Winkey + R) and follow the wizard.
    • Francis
      Francis over 8 years
      That is a example, I don't want to net user. The strInput will take from user input from the windows prompt, 1,2,3,4 The first unzip command will run regardless but second command will depend what user input like if user input 1 then run this line if user input 2 then run this line, I have 4 to 5 if statement.
    • Susilo
      Susilo over 8 years
      That problem not presented by current question..how if used in your code? etc..please update your question!..