On 3/6/07, Francis Avila <[EMAIL PROTECTED]> wrote:
> When you run a file as an executable (using either #! or fish
> <filename>), fish attempts to parse things that look like options
> (i.e., start with a dash), and fails if they are not valid options to
> fish.
>
> See the following transcript:
> [EMAIL PROTECTED] ~> fish --version
> fish, version 1.22.3
> [EMAIL PROTECTED] ~> uname -a
> Darwin host.domain 8.8.0 Darwin Kernel Version 8.8.0: Fri Sep  8
> 17:18:57 PDT 2006; root:xnu-792.12.6.obj~1/RELEASE_PPC Power
> Macintosh powerpc
> [EMAIL PROTECTED] ~> cat >test
> #! /usr/bin/env fish
> echo $argv
> ^D
> [EMAIL PROTECTED] ~> chmod +x test
> [EMAIL PROTECTED] ~> fish ./test 1 2 3 #works fine because no dashes
> 1 2 3
> [EMAIL PROTECTED] ~> ./test o-o # also fine
> o-o
> [EMAIL PROTECTED] ~> fish ./test --longopt
> fish: unrecognized option `--longopt'
> [EMAIL PROTECTED] ~> fish ./test -opt
> fish: invalid option -- o
> [EMAIL PROTECTED] ~> fish ./test -o
> fish: invalid option -- o
> [EMAIL PROTECTED] ~> fish ./test -1 -2 -3
> fish: invalid option -- 1
> [EMAIL PROTECTED] ~> ./test -1 -2 -3
> fish: invalid option -- 1
>
>
> All these dashed arguments should have been passed to ./test without
> fish parsing them as arguments to fish, so ./test can parse them if
> it wants.  The current behavior makes it impossible to pass dashed
> args to fish scripts intended to be executed directly (you must
> source them).  This breaks, for example, the fish seq fallback when
> used with negative numbers (which has a bug with negative step
> values: I'll post a patch for that).
>
> This is how /bin/sh (and the like) behave:
>
> [EMAIL PROTECTED] ~> cat >test
> echo $@
> ^D
> [EMAIL PROTECTED] ~> sh ./test -1 -2 -3
> -1 -2 -3
> [EMAIL PROTECTED] ~> sh -1 -2 -3 ./test
> sh: -1: invalid option
> Usage:  sh [GNU long option] [option] ...
> ...
>
> If the arguments are before the file to execute, they are parsed as
> arguments to sh; if they are after, they are not parsed, but passed
> to the script's [EMAIL PROTECTED]

Thank you for the bug report. Unless you provide a patch, I'll try to
do so next week.

> --
> Francis Avila
>

-- 
Axel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to