X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Message-ID: <4B17198C.1030007@cygwin.com> Date: Wed, 02 Dec 2009 20:51:08 -0500 From: "Larry Hall (Cygwin)" Reply-To: cygwin AT cygwin DOT com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090320 Remi/2.0.0.21-1.fc8.remi Lightning/0.9 Thunderbird/2.0.0.21 Mnenhy/0.7.5.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Fwd: bash script bugs References: <846d84d90912021712j574b7749o9d9548203d21b901 AT mail DOT gmail DOT com> <846d84d90912021720u608dd955s8ade1429e88a0d5e AT mail DOT gmail DOT com> In-Reply-To: <846d84d90912021720u608dd955s8ade1429e88a0d5e@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On 12/02/2009 08:20 PM, Sergey Ivanov wrote: > Have a script: > #!/usr/bin/bash > f="$(ls $1)" > for v_file in "$f"; do > echo $v_file > done > named FileGroupContentsChange.sh. > > Twos things do not work as they should. By order: > 1) Output in command line for nest commands > ls /cygdrive/d/install/buf/*.html > dir /cygdrive/d/install/buf/*.html > is same: > /cygdrive/d/install/buf/a.html > /cygdrive/d/install/buf/b.html > > while output for ./FileGroupContentsChange.sh > /cygdrive/d/install/buf/*.html is only > /cygdrive/d/install/buf/a.html This is no bug. It's a user error. If you want FileGroupContentsChange.sh to show both files you either need to escape the '*' in the parameter your pass to it or have the script process all the parameters (i.e. $*) with the internal 'ls' command. > 2) (not critical but not "classical") Both command line script and > outputs for current folder in one line: > ls returns > FileGroupContentsChange.sh cygcheck.out sources > and so ./FileGroupContentsChange.sh do That seems "classical" to me. If you prefer 1 file per line, use the '-1' flag. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _____________________________________________________________________ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple