Quantcast
Channel: Can the Bash shell "Ignore" Excess copy-paste text? - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 4

Can the Bash shell "Ignore" Excess copy-paste text?

0
0

Say, I have a "Quick&Dirty" Perl script in a gui text editor, and I start the Perl interpreter in a terminal window which is running Bash. I can copy-paste the Perl script to the terminal & press CTRL-D to execute it with Perl. Perl will interpret the script and execute it.

Sometimes, there is a typo in the script, which makes Perl print a FATAL ERROR and exit, but the remaining copy-paste text is given to the Bash shell which tries to execute that; Either that fails (lucky case) or executes but will Do something Different (unlucky case).

Eg : start Perl in Bash Prompt , copy-paste a script of 5 lines : lines 1 & 2 are fine , but line 3 makes Perl exit abnormally , hence line 4 & 5 are executed by Bash.

I am using Perl & Bash only for example; Problem can happen with many other interactive tools ( Eg Python, fdisk ) and other shells ( Eg zsh, csh )

Is there any way to inform the shell that this text is a copy-paste input and can be ignored ?
Something like "If faster than user can normally type, then Ignore" ?
Or something like "If Process finished, then flush input buffer before reading next shell input" ?

[[ Some tools do not have this problem, Eg MySQL cli will never exit on improper input. ]]


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images