Skip to main content

All Questions

Tagged with
0 votes
1 answer
42 views

What is (if any) the file descriptor of /dev/tty?

The urgent issue to read keyboard input in the pipeline is solved by the answer in https://stackoverflow.com/questions/15230289/read-keyboard-input-within-a-pipelined-read-loop: mycommand-outputpiped |...
Martian2020's user avatar
  • 1,363
3 votes
1 answer
153 views

How to ensure that SSH client leave stdout file descriptor clean for reuse?

This code terminates with error : ( ssh localhost seq 100000 seq 100000 ) | wc #-> seq: write error: Resource temporarily unavailable This is a minimal code to reproduce the write error. ...
Thibault LE PAUL's user avatar
5 votes
2 answers
504 views

What is the difference between `{ echo err >&2; echo out >&1; } | :` and `{ echo out >&1; echo err >&2; } | :` in Bash?

Why can the command { echo err >&2; echo out >&1; } | : print "err", but the second can not? Some tests in container: Debian: 11.5 (bash/5.1.4) Rocky Linux: 9.0 (bash/5.1.8), ...
qyecst's user avatar
  • 53
-1 votes
1 answer
36 views

Create multi-command pipeline producer command

Kind of blanking on how to do this right: { echo Hello1; usleep 500000 ;# sleep 500,000 microseconds echo Hello2; } | node break-out-of-loop.js I just want to issue some stdin and delay ...
Alexander Mills's user avatar
-3 votes
1 answer
255 views

Extract an ID that matches the user login from a table on shell script

So, I have all these user login information (service, admin, J009878) and this table you see here comes from another command whose output is this table which I save in file.txt. What I want to achieve ...
BishwashK's user avatar
1 vote
2 answers
484 views

Print output of httpie command, then pipe to grep

how can I print output of httpie request then pipe to grep to check if request has succeeded or failed? http --print=hb POST http://localhost:8080 | grep -c "HTTP/1.1 200" && echo &...
sc0rp10n.my7h's user avatar
2 votes
0 answers
446 views

bash: writing to the file descriptor #3 of an unnamed (anonymous) pipe

I need to call a PHP interpreter, which is in a docker container, from my Linux host system. For some reasons I don't want to install PHP on the host system. Now I'm trying to call PHP in this way: ...
novascriptum's user avatar
1 vote
2 answers
454 views

In Bash, how can I compute and capture the result from an intermediate node in a pipeline?

In Bash, how can I compute and capture the result from an intermediate node in a pipeline? For example, given a list of integers and a command or function maximum, using a single Bash pipeline, how ...
Derek Mahar's user avatar
4 votes
1 answer
688 views

PIPESTATUS variable is empty

I'm working on a Linux server and noticed that the PIPESTATUS array variable is always empty. I'm on bash v4.1.2(1)-release $ echo $BASH_VERSION 4.1.2(1)-release $ false | true | false $ echo ${...
Pavan's user avatar
  • 163
3 votes
1 answer
9k views

Shell pipe with "echo" [duplicate]

Can someone explain me, why the following doesn't work: echo hello | echo - Just for learning purposes (don't tell me to use something else and not "echo" or why do I need it), I want to ...
FLUSHER's user avatar
  • 161
1 vote
1 answer
1k views

/bin/sh closes immediately without waiting for user input

I am exploiting a Buffer Overflow vulnerability for educational purposes. My goal is to trigger a shell by changing the RIP and targeting the evil function. I am using Ubuntu 18.04 64-bits. Here is ...
mateleco's user avatar
  • 220
0 votes
2 answers
3k views

How can I read from named pipe line by line and exit?

I have the following bash script that I'd like to use as a fuzzy file opener. I create a fifo, spawn a new terminal with fzf running and redirect fzf's output to the fifo. I then call a function that ...
noibe's user avatar
  • 407
1 vote
1 answer
982 views

Use piped content in a python script passed as heredoc

I am aware that here-doc goes to stdin. I saw that here-doc takes precedence in going to stdin before what's coming from the pipe (see below). But maybe there's a trick to make it work? All in all I ...
gregolsky's user avatar
2 votes
1 answer
242 views

Redirecting to `stdin`: who outputs the contents afterwards?

Consider the following example in Bash shell $ echo 'test' | wc -c 5 Everything works as expected. Now let's change it to $ echo 'test' >&0 | wc -c test 0 Now, that 0 in the output makes ...
AnT stands with Russia's user avatar
2 votes
3 answers
2k views

How to pass two stdin to sudo?

My goal is to write something to a file that needs superuser privileges and I want to do it with a single line of code. Steps I have tried: I can pass a password from stdin to sudo by using its -S ...
e_moro's user avatar
  • 119

15 30 50 per page
1
2 3 4 5 6