Skip to main content
deleted 56 characters in body
Source Link
cprn
  • 1.1k
  • 3
  • 14
  • 27

I wrote a simple script whichthat echo-es its own PID every half a second:

#/bin/bashsh while true; do echo $$;$$ sleep 0.5;5 done 

I'm running said script (it says 3844 over and over) in one terminal and trying to tail the file descriptor in another one:

$ tail -f /proc/3844/fd/1 

It doesn't print anything to the screen and hangs until ^c. Why?

Also, all of the STD file descriptors (IN/OUT/ERR) link to the same pts:

$ ls -l /proc/3844/fd/ total 0 lrwx------ 1 mg mg 64 sie 29 13:42 0 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 1 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 2 -> /dev/pts/14 lr-x------ 1 mg mg 64 sie 29 13:42 254 -> /home/user/test.sh lrwx------ 1 mg mg 64 sie 29 13:42 255 -> /dev/pts/14 

Is this normal?

Running Ubuntu GNOME 14.04.

If you think this question belongs to SO or SU instead of UL, do tell.

I wrote a simple script which echo-es its PID:

#/bin/bash while true; do echo $$; sleep 0.5; done 

I'm running said script (it says 3844 over and over) in one terminal and trying to tail the file descriptor in another one:

$ tail -f /proc/3844/fd/1 

It doesn't print anything to the screen and hangs until ^c. Why?

Also, all of the STD file descriptors (IN/OUT/ERR) link to the same pts:

$ ls -l /proc/3844/fd/ total 0 lrwx------ 1 mg mg 64 sie 29 13:42 0 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 1 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 2 -> /dev/pts/14 lr-x------ 1 mg mg 64 sie 29 13:42 254 -> /home/user/test.sh lrwx------ 1 mg mg 64 sie 29 13:42 255 -> /dev/pts/14 

Is this normal?

Running Ubuntu GNOME 14.04.

If you think this question belongs to SO or SU instead of UL, do tell.

I wrote a simple script that echo-es its own PID every half a second:

#/bin/sh while true; do echo $$ sleep .5 done 

I'm running said script (it says 3844 over and over) in one terminal and trying to tail the file descriptor in another one:

$ tail -f /proc/3844/fd/1 

It doesn't print anything to the screen and hangs until ^c. Why?

Also, all of the STD file descriptors (IN/OUT/ERR) link to the same pts:

$ ls -l /proc/3844/fd/ total 0 lrwx------ 1 mg mg 64 sie 29 13:42 0 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 1 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 2 -> /dev/pts/14 lr-x------ 1 mg mg 64 sie 29 13:42 254 -> /home/user/test.sh lrwx------ 1 mg mg 64 sie 29 13:42 255 -> /dev/pts/14 

Is this normal?

Running Ubuntu GNOME 14.04.

deleted 1 character in body
Source Link
cprn
  • 1.1k
  • 3
  • 14
  • 27

I wrote a simple script which echo-es its PID:

#/bin/bash while true; do echo $$; sleep 0.5; done 

I'm running said script (it says 3844 over and over) in one terminal and trying to tail the file descriptor in another one:

$ tail -f /proc/3844/fd/1 

It doesn't print anything to the screen and hangs until ^c. Why? 

Also, all of the STD file descriptors (IN/OUT/ERR) link to the same pts:

$ ls -l /proc/3844/fd/ total 0 lrwx------ 1 mg mg 64 sie 29 13:42 0 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 1 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 2 -> /dev/pts/14 lr-x------ 1 mg mg 64 sie 29 13:42 254 -> /home/mguser/test.sh lrwx------ 1 mg mg 64 sie 29 13:42 255 -> /dev/pts/14 

Is this normal?

Running Ubuntu GNOME 14.04.

Also, ifIf you think this question belongs to SO or SU instead of UL, do tell.

I wrote a simple script which echo-es its PID:

#/bin/bash while true; do echo $$; sleep 0.5; done 

I'm running said script (it says 3844 over and over) in one terminal and trying to tail the file descriptor in another one:

$ tail -f /proc/3844/fd/1 

It doesn't print anything to the screen and hangs until ^c. Why? Also, all of the STD file descriptors (IN/OUT/ERR) link to the same pts:

$ ls -l /proc/3844/fd/ total 0 lrwx------ 1 mg mg 64 sie 29 13:42 0 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 1 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 2 -> /dev/pts/14 lr-x------ 1 mg mg 64 sie 29 13:42 254 -> /home/mg/test.sh lrwx------ 1 mg mg 64 sie 29 13:42 255 -> /dev/pts/14 

Is this normal?

Running Ubuntu GNOME 14.04.

Also, if you think this question belongs to SO or SU instead of UL, do tell.

I wrote a simple script which echo-es its PID:

#/bin/bash while true; do echo $$; sleep 0.5; done 

I'm running said script (it says 3844 over and over) in one terminal and trying to tail the file descriptor in another one:

$ tail -f /proc/3844/fd/1 

It doesn't print anything to the screen and hangs until ^c. Why? 

Also, all of the STD file descriptors (IN/OUT/ERR) link to the same pts:

$ ls -l /proc/3844/fd/ total 0 lrwx------ 1 mg mg 64 sie 29 13:42 0 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 1 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 2 -> /dev/pts/14 lr-x------ 1 mg mg 64 sie 29 13:42 254 -> /home/user/test.sh lrwx------ 1 mg mg 64 sie 29 13:42 255 -> /dev/pts/14 

Is this normal?

Running Ubuntu GNOME 14.04.

If you think this question belongs to SO or SU instead of UL, do tell.

Source Link
cprn
  • 1.1k
  • 3
  • 14
  • 27

Why can't I `tail -f /proc/$pid/fd/1`?

I wrote a simple script which echo-es its PID:

#/bin/bash while true; do echo $$; sleep 0.5; done 

I'm running said script (it says 3844 over and over) in one terminal and trying to tail the file descriptor in another one:

$ tail -f /proc/3844/fd/1 

It doesn't print anything to the screen and hangs until ^c. Why? Also, all of the STD file descriptors (IN/OUT/ERR) link to the same pts:

$ ls -l /proc/3844/fd/ total 0 lrwx------ 1 mg mg 64 sie 29 13:42 0 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 1 -> /dev/pts/14 lrwx------ 1 mg mg 64 sie 29 13:42 2 -> /dev/pts/14 lr-x------ 1 mg mg 64 sie 29 13:42 254 -> /home/mg/test.sh lrwx------ 1 mg mg 64 sie 29 13:42 255 -> /dev/pts/14 

Is this normal?

Running Ubuntu GNOME 14.04.

Also, if you think this question belongs to SO or SU instead of UL, do tell.