Hello.  I am using fish version 2.6.0.

I wrote the following script: cat testing-test.fish:
---
#!/usr/bin/fish

test -z $argv; and echo NO argument
---

greg@t400 ~/s/bin> ./testing-test.fish
NO argument
greg@t400 ~/s/bin> ./testing-test.fish 1
greg@t400 ~/s/bin> ./testing-test.fish 1 2
test: unexpected argument at index 2: '2'
greg@t400 ~/s/bin> ./testing-test.fish 1 2 3
test: Expected a combining operator like '-a' at index 2
g

No surprises when called with no command line arguments or with "1", but
after that it goes off the rails.  Am I doing it wrong?  If so, what is
the proper fishy way to test for the existence of command line
arguments?

Note that I discovered this problem in a larger more sophisticated
script, but I have simplified and condensed it.  The excerpt from my
actual script is:
---
if test -z $argv;            set delay 300
else if test $argv[1] = -s;  set delay $argv[2]
else;                        set delay (expr $argv[1] '*' 60)
end
---

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to