Tanks for tips, but my question is about the second function.

Il giorno 21/giu/2013 20:50, "Josh Tilles" <merelyapseudo...@gmail.com> ha
scritto:
>
> It looks like you're trying using the percent symbol "%" for division.
I'm pretty sure fish uses % for process-expansion or something.
>
> You probably want:
>
> function _even
> math "$argv[1]%2 == 0"
> # could also do:
> # math " ( $argv[1] % 2 )  ==  0"
> # if you wanted the spacing or operator precedence to be clearer.
> end
>
> See http://fishshell.com/docs/2.0/commands.html#math for a bit of an
explanation. (The parentheses on the left-hand side are optional, btw.)
>
> On Jun 21, 2013, at 2:33 PM, Costantino Giuliodori <
costantino.giuliod...@gmail.com> wrote:
>
>> why this type of function is not possible?
>>
>> function _even
>>         test ($argv[1]%2) = 0
>> end
>>
>>
>> function _filter_array
>>
>>     for a in $argv[2..]
>>         if eval $argv[1]
>>             set res $res $a
>>         end
>>     end
>>
>> end
>>
>> --
>> Costantino
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to