linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: walter harms <wharms-fPG8STNUNVg@public.gmane.org>
To: Marcus Geiger <geiger.marcus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: man 1 getopts example code - wrong dash
Date: Mon, 27 Feb 2017 17:02:02 +0100	[thread overview]
Message-ID: <58B44D7A.1090905@bfs.de> (raw)
In-Reply-To: <CADOJ=xsjhuZ7_r8JXgfcgXVRi-bf1gN9irBnOePra+i-xv9HuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

i tried the example from http://man7.org/linux/man-pages/man1/getopts.1p.html
and it failed because some invisible chars where embedded

sh -x page.sh
+ aflag=
+ bflag=
+ getopts ab: name
+ '[' '!' $'\342\210\222z' '' ']'
page.sh: line 13: [: −z: unary operator expected
+ '[' '!' $'\342\210\222z' '' ']'
page.sh: line 16: [: −z: unary operator expected
page.sh: line 19: 1 − 1: syntax error: invalid arithmetic operator (error token is "− 1")

this does not happen when i clip the example rendered with groff (aka man).

i guess your problem may have the some origin.

re,
 wh


Am 27.02.2017 15:16, schrieb Marcus Geiger:
> Hello,
> 
> in the examples section of `man 1 getopts`, every dash/minus used in the
> example code cannot be parsed by bash. vi claims it's 0x2212 instead of 0x2d.
> 
> I'm on Ubuntu 16.04 with bash 4.3.46(1)-release. Unfortunately I couldn't find
> the source code for this man page, but the current online pages entry also has
> this problem: http://man7.org/linux/man-pages/man1/getopts.1p.html
> 
> The containing package is:
> 
>    $ dpkg -S $(man -w 1 getopts)
>    manpages-posix: /usr/share/man/man1/getopts.1posix.gz
> 
> Kind regards
> 
> Marcus Geiger
> --
> To unsubscribe from this list: send the line "unsubscribe linux-man" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-02-27 16:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27 14:16 man 1 getopts example code - wrong dash Marcus Geiger
     [not found] ` <CADOJ=xsjhuZ7_r8JXgfcgXVRi-bf1gN9irBnOePra+i-xv9HuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-27 16:02   ` walter harms [this message]
2017-03-13  3:31   ` Mike Frysinger
2017-12-03 15:25     ` minus signs instead of hyphen-minuses in man-pages-posix-2013-a (was: man 1 getopts example code - wrong dash) Nico R.
     [not found]       ` <20171203152541.GB8608-apn8OiFnwzd6HCqoLBzdJtgH40HQ1Lc/@public.gmane.org>
2018-02-09  7:22         ` minus signs instead of hyphen-minuses in man-pages-posix-2013-a (was: man 1 getopts example code - w Daniel Lublin

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=58B44D7A.1090905@bfs.de \
    --to=wharms-fpg8stnunvg@public.gmane.org \
    --cc=geiger.marcus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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 NNTP newsgroup(s).