From: Eliot Moss <moss@cs.umass.edu>
To: "Morten Kjærulff" <mortenkjarulff@gmail.com>, cygwin@cygwin.com
Subject: Re: #!/bin/sh vs #!/bin/bash filename expansion after <
Date: Wed, 12 Aug 2020 14:24:17 -0400 [thread overview]
Message-ID: <3d0b9130-0df1-744a-1693-4bfff4686375@cs.umass.edu> (raw)
In-Reply-To: <CA+7cx1rLR-s9vEu587aUycQ6GqNBLTYaeXL4Q7Ff6GNAJ4pNow@mail.gmail.com>
On 8/12/2020 1:54 PM, Morten Kjærulff via Cygwin wrote:
> Hi,
>
> This script:
>
> #!/bin/sh
> echo hello >hello.txt
> ls -l
> cat hell*
> cat < hell*
>
> gives me:
>
> $ ./t.sh
> total 2
> -rw-r--r-- 1 vp01mkf Domain Users 6 Aug 12 19:51 hello.txt
> -rwxr-xr-x 1 vp01mkf Domain Users 60 Aug 12 19:51 t.sh
> hello
> ./t.sh: line 5: hell*: No such file or directory
>
> But if I change line1 to
> #!/bin/bash
> I get
> hello
> hello
>
> Is that correct behaviour. I guess so, but why? And what is the rule?
The bash man page describes how its behavior is different when run as sh vs bash :-) ... EM
next prev parent reply other threads:[~2020-08-12 18:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-12 17:54 Morten Kjærulff
2020-08-12 18:24 ` Eliot Moss [this message]
2020-08-12 20:07 ` Andrey Repin
2020-08-12 20:53 ` Eliot Moss
2020-08-12 21:07 ` Ken Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3d0b9130-0df1-744a-1693-4bfff4686375@cs.umass.edu \
--to=moss@cs.umass.edu \
--cc=cygwin@cygwin.com \
--cc=mortenkjarulff@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).