2015-09-10 15:22:05 -0400, -:
> 
> Hello, I'm fairly new to screen.
> 
> Is there a way to send a command from within an application running
> in a screen session to the shell?  For example, without leaving the
> application can I send a shell script to perform a task then return
> to the application?
[...]

It's not clear what you're asking.

In each "screen" "window", "screen" typically runs a shell. In
that shell, you may run an application. While that application
runs, the shell is just idle waiting for the application to
finish (and is not otherwise expecting any input).

screen itself is just a terminal emulator.

Now, nothing stops that application starting other commands be
them scripts, or not.

If you mean you want to run another application, specifically a
script, that runs concurrently with the application currently
running in your shell and screen window, you can do the same as
with any other terminal emulator: interrupt the "application"
with CTRL-Z, but it in background with "bg" and run the second
application ("script") in forground from your shell (or both in
background, or the script in background with "&" and then resume
your application in foreground with "fg".

Alternatively, you can run another application that shares the
screen windows with screen's "exec" command.

With ^A:exec myscript

You'd run myscript running in another pseudo-terminal, but
screen would forward the output by "myscript" to that
pseudo-terminal to your screen window, and what you type would
go instead to "myscript" (be redirected by screen to that pseudo
tty).

You can tune how the forwarding of the input/output is done by
the first argument of "exec", which can do very useful things
like have "myscript" post process the output of the applications
run in your window or pre-process your input...

See the documentation about "exec" for more details.

-- 
Stephane

_______________________________________________
screen-users mailing list
screen-users@gnu.org
https://lists.gnu.org/mailman/listinfo/screen-users

Reply via email to