Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14287

Re: -- paramter does not work in bash 4.4

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Eric Blake <eblake@redhat.com>
Newsgroups gnu.bash.bug
Subject Re: -- paramter does not work in bash 4.4
Date Mon, 2 Jul 2018 16:41:31 -0500
Organization Red Hat, Inc.
Lines 56
Approved bug-bash@gnu.org
Message-ID <mailman.2972.1530567699.1292.bug-bash@gnu.org> (permalink)
References <20180630130624.5194E26E27D0@mail.sorunome.de>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1530567701 24749 208.118.235.17 (2 Jul 2018 21:41:41 GMT)
X-Complaints-To action@cs.stanford.edu
To bashreport@oninoni.de, bug-bash@gnu.org, bash@packages.debian.org
Envelope-to bug-bash@gnu.org
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0
In-Reply-To <20180630130624.5194E26E27D0@mail.sorunome.de>
Content-Language en-US
X-Scanned-By MIMEDefang 2.78 on 10.11.54.6
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 02 Jul 2018 21:41:32 +0000 (UTC)
X-Greylist inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 02 Jul 2018 21:41:32 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eblake@redhat.com' RCPT:''
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 66.187.233.73
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14287

Show key headers only | View raw


On 06/30/2018 08:06 AM, bashreport@oninoni.de wrote:

> Description:
> 	[Detailed description of the problem, suggestion, or complaint.]
> 

That wasn't very detailed, so we have no idea how to reproduce what you 
are complaining about to know if it is an actual bash bug, or more 
likely a misunderstanding on your part how things work.

Note that POSIX has a special meaning for -- that most apps obey, where 
it means "end of options" and is silently removed, allowing all 
subsequent arguments on the command line to be taken as literal 
arguments even if they otherwise resemble options.  So, if you expect 
that an argument might start with -, then using the -- separator is common:

$ for arg in '' 1 - --; do printf .%s.\\n "$arg" | grep "$arg"; done
..
.1.
.-.
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
$ for arg in '' 1 - --; do printf -- .%s.\\n "$arg" | grep -- "$arg"; done
..
.1.
.-.
.--.


Meanwhile, there are a few exceptions, like 'echo', that are 
specifically required to behave differently from that normal behavior:

$ echo --
--

Note that POSIX even requires -- to work on applications that don't seem 
to take any options (at least, no options specified by POSIX); this is 
because POSIX allows for extensions:

$ dirname
dirname: missing operand
Try 'dirname --help' for more information.
$ dirname --
dirname: missing operand
Try 'dirname --help' for more information.
$ dirname -- --
.

So, with that said, do you have an example command line that you are 
still confused about, rather than a vague non-report?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: -- paramter does not work in bash 4.4 Eric Blake <eblake@redhat.com> - 2018-07-02 16:41 -0500

csiph-web