| Deutsch English Français Italiano |
|
<vb9mls$3rk17$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lew Pitcher <lew.pitcher@digitalfreehold.ca> Newsgroups: comp.unix.programmer Subject: Re: Always use "--" (Was: Long filenames in DOS/Windows and Unix/Linux) Date: Wed, 4 Sep 2024 13:17:48 -0000 (UTC) Organization: A noiseless patient Spider Lines: 33 Message-ID: <vb9mls$3rk17$1@dont-email.me> References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com> <yga34mfoily.fsf@akutech.de> <87ttevzoj3.fsf@nosuchdomain.example.com> <vb9k2l$3r705$1@dont-email.me> <vb9ls7$1igeo$1@news.xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 04 Sep 2024 15:17:49 +0200 (CEST) Injection-Info: dont-email.me; posting-host="089580a279695161dca4425bbd5038c9"; logging-data="4050983"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX180TaqU1wPBXvNKv+5H9E04ZBGUTHDeprM=" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:XP0xZEezQsToG5l5zlq2YpzOg2k= Bytes: 2479 On Wed, 04 Sep 2024 13:04:07 +0000, Kenny McCormack wrote: > In article <vb9k2l$3r705$1@dont-email.me>, > Nuno Silva <nunojsilva@invalid.invalid> wrote: > ... >>> D'oh! >> >>(Along with these quotes, I'd add ./ before $file.) > > Or, more simply, just put -- after the -p. > > This is an often overlooked aspect of shell programing. You should always > use "--". The "shellcheck" program will tell you this, if you let it. The "--" option is just that, an option coded into the argument parser of the program being invoked. Many programs /do not/ recognize "--" as an "end of flags" argument, so the effectiveness of "--" is unreliable. OTOH, if you specify a fully qualified pathname, (or, at least, a qualified relative pathname), you can assure yourself that the file path provided to the program /will not/ start with the '-' that indicates a program flag. Note that all this is /convention/ and not /requirement/. There are situations in which /none/ of the above applies, as a) the program interprets it's arguments by /position/, or b) the program doesn't use the '-' to introduce flag arguments, or c) the program doesn't take filenames as arguments, or d) some other conditions that I'm too lazy to enumerate HTH -- Lew Pitcher "In Skills We Trust"