[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

un petit script



J'ai écrit un script (trouvé dans linuxmag) :

#!/bin/bash
while [ 1 -lt 2 ]
    do
    /usr/game/fortune > /home/phi/signature  # /home/phi/signature est un tube nommé
    sleep 1
    done

Et quand je le lance par :/home/phi/bin/signature.sh, signature.sh est lancé deux fois....

phi@serveur:/tmp$ ps -ax | grep signature
 7642 pts/1    S      0:00 bash /home/phi/bin/signature.sh
 7643 pts/1    S      0:00 bash /home/phi/bin/signature.sh

un ps axf donne :

phi@serveur:~$ ps axf
  PID TTY      STAT   TIME COMMAND

  396 tty1     S      0:00              \_ x-terminal-emulator
  397 pts/0    S      0:00              |   \_ bash
  414 pts/0    S      0:00              |       \_ bash /home/phi/bin/signature.sh
  415 pts/0    S      0:00              |           \_ bash /home/phi/bin/signature.sh

Donc il semblerait que le deuxieme processus signature.sh soit lancé
par le premier... Comment cela se fait-il ?

Ca vient du tube. Car si je supprime le tube signature avant de lancer
le script puis que je le relance, il n'y a plus qu'un process.
C'est à priori un comportement normal.

Qqun a-t-il une explication à ce comportement ?

-- 
      o                     (La mer est un tapis bleu 
   ___ ° <----- J'ai soif... aux 4 coins du monde secoué
>-|__(°/                     par des gardiens de phare malheureux
    //    >-[_°>            (SNIF)).                             













Reply to: