Re: Décompte différent dans un script et en ligne de comman…

トップ ページ

このメッセージに返信
著者: Christian Marillat
日付:  
To: guilde
古いトピック: Re: Décompte différent dans un script et en lignede commande
新しいトピック: Re: Décompte différent dans un script et en lignede commande
題目: Re: Décompte différent dans un script et en ligne de commande
On 29 janv. 2024 10:26, Patrice Karatchentzeff <patrice.karatchentzeff@???> wrote:

> J'utilise bash pour l'exemple ici, mais en fait j'utilise zsh. Les 2
> me donnent le même résultat. Je ne voulais pas induire un débat sur le
> shell avec mon problème :)


Oui, mais sh ce n'est pas bash ni zsh.

[...]

> strace -f -e execve,clone,fork,waitpid tonscript.sh


,----
| $ strace -f -e execve,clone,fork,waitpid ./monscript.sh
| execve("./monscript.sh", ["./monscript.sh"], 0xbfd26f7c /* 72 vars */) = 0
| clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLDstrace: Process 1557 attached
| , child_tidptr=0xb7f88768) = 1557
| [pid  1557] clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLDstrace: Process 1558 attached
| , child_tidptr=0xb7f88768) = 1558
| [pid  1557] clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7f88768) = 1559
| strace: Process 1559 attached
| ++ ps -edf
| ++ grep -c thunderbird
| [pid  1558] execve("/usr/bin/ps", ["ps", "-edf"], 0x1a2c7f0 /* 72 vars */ <unfinished ...>
| [pid  1559] execve("/usr/bin/grep", ["grep", "-c", "thunderbird"], 0x1a2c7f0 /* 72 vars */ <unfinished ...>
| [pid  1558] <... execve resumed>)       = 0
| [pid  1559] <... execve resumed>)       = 0
| [pid  1558] +++ exited with 0 +++
| [pid  1559] +++ exited with 0 +++
| [pid  1557] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1558, si_uid=1000, si_status=0, si_utime=0, si_stime=10 /* 0.10 s */} ---
| [pid  1557] +++ exited with 0 +++
| --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1557, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
| + command=5
| + echo command=5
| command=5
| + [[ 5 > 5 ]]
| +++ exited with 0 +++

`----

Christian