a little shell problem

トップ ページ
添付ファイル:
Eメールのメッセージ
+ (text/plain)
このメッセージを削除
このメッセージに返信
著者: Bob George
日付:  
題目: a little shell problem
Lynn David Newton wrote:
> I'm writing a script (in ksh, not bash, but I believe
> the problem is the same in either shell) where I have
> to write some files to a number of login directories.
> Putting a list of targets in a variable near the top
> like this turns off tilde expansion:>
> rather than
>
 > for client in ~joe/foo \
 >               ~blow/foo \
 >           ~shmo/blah
 > do
 >   stuff
 > done

>
> Surely this is an easy thing, but I've got a mental
> block. Can someone help me get my blinders off? Thanks.


This works in bash:

for CLIENTS in $(cat file); do ls -l ~${CLIENTS}/.bash\*; done

where <file> contains a list of usernames, 1 per line.

- Bob