On Sun, Sep 3, 2017, at 20:06, Mark Volkmann wrote:
> IIUC, there isn't a command in fish that can be used to compare two strings 
> to see if one is greater than the other in sorting order. For example, this 
> doesn't work:
> 
> set v1 'foo';
> set v2 'bar';
> if test $v1 > $v2
>   ...
> end
> 
> Is there a recommended workaround for this?

The wonderful (POSIX standard) command expr [1] will work.

set v1 foo
set v2 bar
if expr $v1 '>' $v2 >/dev/null
    echo true
else
    echo false
end

[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/expr.html

------------------------------------------------------------------------------
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