bug-bash
[Top][All Lists]
Advanced

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

Re: unfamiliar construct...


From: Pierre Gaston
Subject: Re: unfamiliar construct...
Date: Sat, 23 Mar 2013 11:07:58 +0200

On Sat, Mar 23, 2013 at 3:15 AM, Linda A. Walsh <law@tlinx.org> wrote:
> In reading some suse startup code (*shiver*),
>
> I came across this construct
>
>
>
> func() {
> local comm       ## command from /proc/$pid/stat
>
> for comm; do
>     test -s comm || continue
>     ppid = pidofproc $comm
>     parents="${parents:+parents:}${ppid}"
> done
> }
> -------------------
> Is that valid code?  does for have some arcane usage
> to test if the contents of it exists as a file or something?

`for comm;d'o is like: `for comm in "$@";do'

The 2 lines after that are definitely wrong though and should probably look like
test -s $comm || continue
ppid=$(pidofproc $comm)

(without trying to guess what the purpose of this function)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]