[Top][All Lists]

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

Unfamiliar; what does this do: "for file do"..."done"

From: L. A. Walsh
Subject: Unfamiliar; what does this do: "for file do"..."done"
Date: Sat, 13 Aug 2016 04:35:58 -0700
User-agent: Thunderbird

I was looking at how the 'ldd' command(bash script) on my system and
came across the code usage:

for file do       ## about line 138 in my version
 case $file in
 */* :
 *) file=./$file

It doesn't appear to set the value of file in any of the code
above the 'for' statement, but is using it in the case statement
just below the 'for' statement.

As far as I can tell, nothing between the "do" and "done" is
executed, which as far as I know, would seem to be expected
behavior.  The 1st line of the file has:

#! /bin/bash

indicating bash (v. posix) semantics.

Is there some shell construct that should make this work (execute),
or is this "effectively" commenting this section out, though still
processing quotes?

Seems to have been this way for, the past several years leading me
to think that the code path doesn't get used, or it's using
some unknown bash functionality.

It looks like it was intended to loop over program arguments left
over after flag processing, but that's a guess based on the program

Any ideas?


reply via email to

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