At Wed, 8 Nov 2000 21:08:07 +0900, Taketoshi Sano <kgh12351 _at_ nifty.ne.jp> wrote: > > 佐野@浜松です。 > > In <87hf5jd2lm.wl _at_ sextant.weatherlight.org>, > on "Wed, 8 Nov 2000 04:06:21 +0900', > with "RE: shell scriptのforループ", > OZAWA -Crouton- Sakuro <crouton _at_ weatherlight.org> さん wrote: > > > > 例えば,カレントディレクトリにある全てのzip archiveを展開する場合 > > > $ for i in `ls *zip`; do unzip $i; done > > > と実行すると,ファイル名に空白があるファイルを処理することができ > > > ません. > > > 私だったら、上のループに限っては、 > > > > $ ls -1 *.zip | sed 's/^/unzip /' | sh > > > > とするでしょうが。 > > 「B shell の for loop」という条件を無視して良いのなら > > find . -name '*.zip' -print0 -maxdepth 1 | xargs unzip > > とか。 > > IFS をいじるのも簡単そうですが。 > > $ ls -1 > a b > c d > chk > $ for i in $(ls); do echo $i; done; > a > b > c > d > chk > $ IFS='\n'; for i in $(ls); do echo $i; done; > a b > c d > chk > $ unset IFS; for i in $(ls); do echo $i; done; > a > b > c > d > chk > > -- > # (わたしのおうちは浜松市、「夜のお菓子」で有名さ。) > <kgh12351 _at_ nifty.ne.jp> : Taketoshi Sano (佐野 武俊) > >
References:
- [linux-users:75758] shell scriptのforループTSUCHIYA Yoshihiro
- [linux-users:75759] RE: shell scriptのforループOZAWA -Crouton- Sakuro
- [linux-users:75792] Re: shell scriptのforループTaketoshi Sano
- Prev by Subject: [linux-users:76247] VMware & Scroll Mouse
- Next by Subject: [linux-users:76249] Re: メールに よる機密漏洩対策
- Previous by thread: [linux-users:75909] Re: shell scriptのforループ
- Next by thread: [linux-users:75773] Re: shellscriptのforループ
- Indexes:[Main][Thread]