Skip to main content

Questions tagged [file-descriptors]

4 votes
1 answer
869 views

I found out I don't totally understand how bash file descriptors work. I would like to have some guidance here. I have a scenario where I need to read the content of a file, and for each line of the ...
sylye's user avatar
  • 718
1 vote
1 answer
152 views

Suppose I have some process that when ready will output to stdout. Even though I want my script to run asynchronously with respect to that process, I still want the script to block and wait on that ...
Mathias Sven's user avatar
5 votes
2 answers
451 views

`I'm reading an answer to https://stackoverflow.com/questions/692000/how-do-i-write-standard-error-to-a-file-while-using-tee-with-a-pipe/692009#692009, https://stackoverflow.com/a/14737103/5499118: { {...
Alex Martian's user avatar
  • 1,319
3 votes
1 answer
187 views

Please confirm/correct me. I've found related Duplication of file descriptors in redirection but that does not answer my specific question. From the The GNU Bash Reference Manual, section 3.6 ...
Martian2020's user avatar
  • 1,501
0 votes
0 answers
70 views

I want to only print the debug output on failure, this is my attempt: #!/bin/bash set -euo pipefail dt-api() { # shellcheck disable=SC2086 curl \ --fail-with-body \ --silent \ ...
Jakub Bochenski's user avatar
0 votes
1 answer
121 views

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,501
2 votes
2 answers
532 views

for the following command output=$(cat $file | docker exec -i CONTAINER COMMAND 2>&1 | tee /dev/stderr) what is the meaning and usage of 2>&1 | tee /dev/stderr? I google and 2>&...
user1169587's user avatar
7 votes
1 answer
1k views

Given the following code: out="$(mktemp)" rm -f "$out" clear printf '%s\n' 0 >"$out" { printf '%s\n' '1' >/dev/stdout printf '%s\n' '2' >/dev/stdout } &...
balupton's user avatar
  • 644
1 vote
0 answers
91 views

I have a process stuck in uninterruptible sleep. The problematic syscall is a read syscall towards /dev/fd0, which is not backed by a real floppy drive. I am trying to use modprobe and rmmod (both ...
MichaelAttard's user avatar
1 vote
1 answer
111 views

I have a doubt on what the entry created in the Open File Table upon calling open() contains. The following schema from bytebytego seems quite good to understand the big picture of opening a file, ...
pochopsp's user avatar
  • 113
1 vote
1 answer
264 views

I have script script.sh: #!/usr/bin/env bash # pm2 seems to always run in `bash` regardless of `#!` echo "running in $(readlink -f /proc/$$/exe)" # Redirect to both stdout(1) and stderr(2) ...
Amith's user avatar
  • 323
2 votes
1 answer
392 views

Context: I have cursory bash experience. I do not fully get file descriptors, just some basic usage. Trying to create a setup script. Most done, but a few "kinks" remain. So here is a newbie ...
mawi's user avatar
  • 23
0 votes
0 answers
31 views

A question at stackoverflow has answers that show the following way of detecting if standard output is a pipe: if [ -t 1 ] ; then echo terminal; else echo "not a terminal"; fi The -t flag ...
glibg10b's user avatar
  • 428
1 vote
0 answers
129 views

I've got a multithreaded program in which a sem_open with O_CREAT occasionally fails with EBADF. This is on an ARM linux 4.9.88, from NXP, on an embedded device. It is very difficult to reproduce, ...
Matt DiMeo's user avatar
1 vote
1 answer
913 views

I have a bash script listening on a pipe for commands. When it sees a command it runs it. However, I would like it to support the "sideloading" of bash functions that can be called at a ...
nopcorn's user avatar
  • 9,379

15 30 50 per page
1
2 3 4 5
27