On Tue, Nov 11, 2014, at 05:45 PM, Marcin Zajączkowski wrote: > Another question related to fish scripting. How can I set a value to a > variable to be able to use it in `if`? > > if test $myBool > ... > end
The shell's only notion of true and false (this is true for all unix shells that I know) is that an exit status of zero is true and an exit status of non-zero is false. If you want to set variables to "true" and "false" then you can use code like this: if test "$var" = true; echo true; else; echo false; end If you don't use the double quotes around the variable, you'll get a confusing error when the variable is not set. In fish, if expects the condition to be a command, so you cannot use a variable directly like "if $var". -- http://www.fastmail.fm - A fast, anti-spam email service. ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk _______________________________________________ Fish-users mailing list Fish-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fish-users