English 中文(简体)
从外部指挥
原标题:Ask a running bash (interactive) to run a command from outside

我有一个固定的终点站(Xterm),其运行速度快。 附录一知道这张双管铺和与这个终点站有关的tty。 是否有任何办法,但根本不触及这个终点站,而只是使用粗略和粉碎的信息,来要求这一运行良好的布道进行指挥? 基本上重复“共同”和“共同”;仅仅显示终点站的指挥,而作为用户投入的Bash don t接收。

最佳回答

使用<条码>TIOCSTI ioctl。 C类例:

char* cmd="ls
";
int fd = open (ptsname, O_RDWR);

while (*cmd)
{
    ioctl(fd, TIOCSTI, cmd++);
}
问题回答

(2017年) 文字或指挥线如下:

stty -echo; perl -le  require "sys/ioctl.ph"; ioctl(STDIN, &TIOCSTI, $_) for split "", join " ", @ARGV   `_cmds_` ;stty echo; _app_

如果您放弃最后的app,cmds的输出将出现在输入点上(正如在座右铭上所呼吁的那样),或出现在目前的星号上,或者在shell的指挥线上。stty只是停留在屏幕上。

<>说明:在技术上,这并不明确“模拟关键词”。

但其指挥仅在同一个终点站进行,不仅在木板/诺给的其他终点站进行。





相关问题
Parse players currently in lobby

I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

Bash usage of vi or emacs

From a programming standpoint, when you set the bash shell to use vi or emacs via set -o vi or set -o emacs What is actually going on here? I ve been reading a book where it claims the bash shell ...

Dynamically building a command in bash

I am construcing a command in bash dynamically. This works fine: COMMAND="java myclass" ${COMMAND} Now I want to dynamically construct a command that redirectes the output: LOG=">> myfile.log ...

Perform OR on two hash outputs of sha1sum

I want perform sha1sum file1 and sha1sum file2 and perform bitwise OR operation with them using bash. Output should be printable i.e 53a23bc2e24d039 ... (160 bit) How can I do this? I know echo $(( ...

Set screen-title from shellscript

Is it possible to set the Screen Title using a shell script? I thought about something like sending the key commands ctrl+A shift-A Name enter I searched for about an hour on how to emulate ...

热门标签