Limit on number of pipes after long-running command? [SOLVED]
I'm trying to create a minimal, crude keylogger for X using only a shell script. I was quickly stumped: Why do these two commands entered in a terminal emulator produce output when I type...
...but this command produces no output:
?
This observation is really challenging my understanding of stdout, stdin, and pipes.
BTW, 6 is the id of my keyboard, which I found by running xinput list. My shell is bash version 5.0.3
Last edited by DevuanFan; 05-16-2019 at 01:10 PM..
Here is the output in the terminal when I type unix after executing the command:
This is the output I want (you'd think this would be the output of the third command in my original post when, in fact, that command outputs nothing): --- Post updated at 03:00 PM ---
@nezabudka: The command you suggested generates no output, either.
@vgersh99: X input devices have id's, which vary from machine to machine (on my machine, X sees the keyboard as input id=6 and mouse as input id=7, for instance).
Yes, the command you suggested gives the desired output when I type unix:
But it still leaves unanswered why we can only use one pipe after xinput test 6. For instance, this command produces no output when I type unix, although I'd expect grep to generate some ouput when u is pressed:
What I'm trying to understand is why one pipe after xinput test 6 works fine, but two pipes never produce any output even when output is expected. That's the point of the thread.
Last edited by DevuanFan; 05-16-2019 at 12:20 PM..
@vgersh: Yes, the command you suggested gives the desired output when I type unix:
But it still leaves unanswered why we can only use one pipe after xinput test 6. For instance, this command produces no output when I type unix, although I'd expect grep to generate some ouput when u is pressed:
What I'm trying to understand is why one pipe after xinput test 6 works fine, but two pipes never produce any output even when output is expected.
well, it's not the "number" of pipes, but the output redirection of xinput:
seems that xinput test 6 put its output not to stdout stream, but to stream with fileDescriptor 6, but the following awk reads its input from stdin (where stdin has the fd=1).
Hence, we need to map fd=6 of xinput to fd=1: 6>&1 for the awk to read its input from fd=1
cat filename| awk '{ $1=""; print $0}'
in my file there are few lines that has more than 3000 characters per line and as soon as I run the above command it cores, strings core reveals that the awk is failing because input string too long, limit. can i get some help from the experts to find... (8 Replies)
I have a topic line in markdown that spans more than 80 characters that i need to add a line break. Markdown is simply treating the line break as a brand new line instead of continuing as a topic line.
Eg:
# This is a very long
line
Markdown interprets it as
This is a very long
line (4 Replies)
Linux top command prints more than 40 processes.
top -b -n 1 > Top_Output.txt
Is there a straight-forward option/way to limit only till the top 5 processes.
( Instead of using head, tail or other unix commands together) (1 Reply)
hi guys
how can i limit number of files in a disk or partition ?
or how can i make a limit to inode number for a disk or partition ?
ext3 or ext4 file system (1 Reply)
Hi frnds
i am newbie in linux and trying to write a simple script for adding users.the problem is i am running a while loop under function and loop is running for 3 time more than limit.Here is my Script and output pls help me out :
# CREATE N NO. OF USERS WITH PASSWORD IN SYSTEM
#... (4 Replies)
Hello, I have some 150 Cron Jobs running under my UNIX account. I want to add some more jobs. Is there a limit to the number of cron jobs that can be run on an account?
Thank you.
Pramodini (8 Replies)
Is there a way that I can limit number of commands that one user can run during period of time. For example Max 10 commands per senconds.:) (3 Replies)
Hi,
I'm using the ksh shell.
The scenario:
I have a couple of directories
/home/fd
/home/fd/prsd
home/fd/stg
now i have number of files in each of these directories.
some of the files are zipped using gzip so their extension is .gz
the content of the files is as follows
... (4 Replies)
Hi
Hi! I'm currently using AIX 5.2 and would like to know where can i find to see that there's a restriction on the number of login times a user can have. Example, I want give a 2 login per user but some one to give 3 login and some one have to give unlit login time (without logging off the... (2 Replies)
I would like to allow only one instance of a script to run at any moment.
I've tried the following solution to count the instances but the result is always the number of running instances plus one and I can't find the problem
ps -ef | grep $0 | sed '/^$/ d' | sed '/grep/ d' | wc -l
Please... (2 Replies)