Fwd: bash script bugs
Larry Hall (Cygwin)
reply-to-list-only-lh@cygwin.com
Thu Dec 3 01:52:00 GMT 2009
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
More information about the Cygwin
mailing list