On Mon, 2 Dec 2013, Matteo Cavalleri wrote:
> 1) “and” and “or” commands:
> 
> i suppose that:
> 
> (and|or) does not change the current exit status.
> 
> does really mean:
> 
> (and|or) does not change the current exit status if the command is not 
> executed
> 
> because that’s what i see from my experiments. I think this behavior is 
> nice, but it took me a while to figure it out, because that sentence in 
> the documentation is a bit misleading in my opinion.

You're right - there should be some clarification.

Although (and|or) do not change the exit status, the commands that are run 
may. However, if you run a command which does not change the exit status 
either, it will remain unchanged. The best example of this is `set`:

~> false; or set bla m; echo $status
1
~> true; and set bla m; echo $status
0
~> true; and false; echo $status
1

> 2) special variables
> 
> in the "special variables” paragraph i see no mentions of the variable 
> $version, but looks like it’s some kind of special, read-only variable, 
> because i can screw the shell with this simple line:
> 
> function test; set -l version 10; echo $version; end
> 
> after defining it all i get is a long list of errors every time i press enter.

If you define a new function called `test`, you're gonna have a bad time. 
The shell uses test all over the place - see `help test`. Defining a 
function takes precedence over the builtin command, so functions calling 
test will fail.

This comes up so often that I wonder if it would be better to replace 
every use of test in the source with 'builtin test' (error-prone) or to 
disallow the loading of functions named test (inelegant).

> by the way wouldn’t it be better to call it “fish_version”?

We have both! $version, like tcsh, and $FISH_VERSION, like bash and zsh. 
They are unexported, read-only variables. They need adding to the 
documentation; I will do so.

David Adam
zanc...@ucc.gu.uwa.edu.au
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to