On 9 July 2012 22:14, David Frascone d...@frascone.com wrote:
$status, like $? in bash, will be overwritten by EVERY command executed.
So, given an abridged version of your example:
codemonkey@monkeytree ~/W/grive function dummy
nonexistant command
echo $status
end
codemonkey@monkeytree ~/W/grive dummy
fish: Unknown command “nonexistant”
Standard input: nonexistant command
^
in function “dummy”,
called on standard input,
nonexistant: command not found
127
codemonkey@monkeytree ~/W/grive echo $status
0
codemonkey@monkeytree ~/W/grive
The 'nonexistant' command sets the status to 127, which is displayed, but,
since the echo executes after the error, echo itself returned zero, which
then zero'ed out the status.
In the discussion of setting your prompt, that's why you have to store the
value. $status is volatile, and will change after every command. Just like
$? in other shells.
Hope this helps,
-Dave
Do you really think I could had written that example without
understanding what you just explained?
moreover: just try adding unexistantcommand at the bottom of your
fish_prompt function: you'll see that it's more complicated than that
(due to the fact that other shells usually compose their prompt with
an env variable with is own syntax, while fish chose a more flexible
-and simpler- approach)
I don't want to get through as being hostile, but I'm getting quite
frustrated by this back and forth...
the issue is imho very simple:
either this is recognized as a true inconsistency, and it's chosen to
be dealt with by adding something to the documentation
or you don't see this as truly inconsistent, and you think I should've
thought out better my fish_prompt function in the first place
either of these decisions are fine, let's just try to settle it with
just few more words, okay? :)
Peace
:Dario
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users