Linked Questions

106 votes
9 answers
72k views

I know you can create a file descriptor and redirect output to it. e.g. exec 3<> /tmp/foo # open fd 3. echo a >&3 # write to it exec 3>&- # close fd 3. But you can do the same ...
dogbane's user avatar
  • 30.8k
111 votes
4 answers
136k views

I saw this line in a script: DEVICE=`dialog --inputbox "Festplatten-Laufzeit auslesen. Gebe Sie das gewünschte Device an: " 0 70 "" 3>&1 1>&2 2>&3` What is 3>&1 1>&...
jsterr's user avatar
  • 1,381
38 votes
4 answers
52k views

I'm trying to read a text file and do something with each line, using a bash script. So, I have a list that looks like this: server1 server2 server3 server4 I thought I could loop over this using a ...
Kenny Rasschaert's user avatar
8 votes
4 answers
13k views

I'm trying to approximate the computer's write speed using dd: dd if=/dev/urandom of=/dev/null bs=1K count=10000 which gives the following output 10000+0 records in 10000+0 records out 10240000 ...
user avatar
3 votes
3 answers
12k views

I'm trying to write a ls wrapper that uses awk to parse the output of ls -lhF. Right now I've split the program into two files - my_ls.sh and my_ls.awk. my_ls.sh's only purpose is to pipe the output ...
westeros91's user avatar
4 votes
3 answers
1k views

What does the following script mean? exec 4<&0 0</etc/XX/cfg read line1 exec 0<&4 It redirects fd0 to fd4, and "/etc/XX/cfg" to fd0. So why does read still work, shouldn't that be ...
daisy's user avatar
  • 55.9k
3 votes
3 answers
2k views

This script was posted as answer to a Question. And I'm trying to work out what's going on. result=$( { { ssh host app-status >&3 3>&-; echo "$?" } | { until read -...
X Tian's user avatar
  • 10.7k
3 votes
1 answer
2k views

I am writing a long-running program in the Linux environment that will be calculating entries in a large table. Every time it comes to the end of the row, it outputs the calculated values into a ...
therealrootuser's user avatar
1 vote
1 answer
601 views

I think this post is not off-topic.We had three traditional file descriptors in Unix contexts: 0 == STDIN 1 == STDOUT 2 == STDERR But in new articles, blogs, posts, answers, or so on, I read more ...
PersianGulf's user avatar
  • 11.3k
3 votes
2 answers
233 views

I have been trying to figure out the relationship between file descriptors. One thing I don't understand is, how is: ls -l /bin/usr > ls-output.txt 2>&1 different from: ls -l /bin/usr 2>...
Works On Mine's user avatar