From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 13 Oct 2006 19:43:10 +0300 From: Michael Shigorin To: "community@altlinux.ru" Message-ID: <20061013164310.GV17369@osdn.org.ua> Mail-Followup-To: "community@altlinux.ru" References: <20061013203122.3e96df7c@greg> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20061013203122.3e96df7c@greg> User-Agent: Mutt/1.4.2.1i Subject: Re: [Comm] =?koi8-r?b?08vSydDUIM7BIGJhc2ggKHByb2JsZW0p?= X-BeenThere: community@lists.altlinux.org X-Mailman-Version: 2.1.9rc1 Precedence: list Reply-To: shigorin@gmail.com, ALT Linux Community List-Id: ALT Linux Community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Oct 2006 16:42:36 -0000 Archived-At: List-Archive: List-Post: On Fri, Oct 13, 2006 at 08:31:22PM +0400, Grigory Fateyev wrote: > #!/bin/bash > DIR=~/www/testsed/ > IFS="\n" Лишнее. > if [ -n "$DIR" ]; then > cd $DIR > for file in `ls *`; do Лучше просто for file in *, не придётся кувыркаться. Или ls | while read file; do ...; done > echo "$file" > cf=`echo "$file" | tr ' ' '_'` Предпочитаю такие места на всякий тоже кавычить: cf="`echo "$file" | tr ' ' '_'`" > echo $cf > if [ $cf != "$file" ]; then > mv "$file" $cf mv "$file" "$cf" (да, тут пробелы, но бывают-то не только пробелы -- как минимум ещё табы) > fi > done > fi -- ---- WBR, Michael Shigorin ------ Linux.Kiev http://www.linux.kiev.ua/