![]() |
|
There's more than one way to do things | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
G'day ejm20, Welcome to the Monastery. I'm not entirely sure what your ultimate goal is here. You wrote "create a perl script in bash" which I find confusing. It seems to me that you could put your bash commands in a bash script and run that from an xterm (or equivalent). Having said that, and based on the code you've managed so far, perhaps you're after something like this:
When I run that, it pops up an xterm window containing:
I can now type more commands into that xterm window. It shuts down normally with exit or Ctrl-D. One thing to note is that the Perl script (which I called pm_11133222_xterm.pl) will block until the xterm window closes. If that's an issue, you can run it in the background. This starts the xterm and returns my normal prompt:
After closing the xterm and hitting enter:
You may, of course, already know how to do that. I didn't think I had gnome-terminal but apparently I do. I'm running Cygwin 3.2.0 (on Win10) so I no doubt got it via some package. I don't have a manpage for it; I found gnome-terminal(1); it says "gnome-terminal is designed to emulate the xterm program ..." but simply replacing xterm with gnome-terminal resulted in various warning and error messages. I got it to run by replacing the last line of script above with:
This now popped up a window with the same initial content as the xterm window described above; subsequent interaction also worked the same. There were, however, two differences: the Perl script did not block; and, I got this warning:
An internet search for that message got quite a few hits. Here's a couple of workarounds to remove the warning:
As I don't use gnome-terminal — fairly obviously as I only just found that I had it — I wasn't particularly interested in delving into this further. If you encounter the same problem and identify a genuine fix (as opposed to a workaround) please share as it may be useful to others in the future. — Ken In reply to Re: perl scripting help
by kcott
|
|