如何比较鱼壳上的整数?

kie*_*ard 6 fish

关于鱼的文献不多。我需要知道是否

    date '+%k' is greater than 8
Run Code Online (Sandbox Code Playgroud)

我该怎么做?谢谢。

rid*_*ish 5

test or [ are the way you would do this. This is true of all shells, since these are external commands.

if [ (date '+%k') -ge 8 ]
    echo "It's larger!"
end
Run Code Online (Sandbox Code Playgroud)


Gri*_*vit 5

You can use the test fish builtin, like:

if test (date +%k) -gt 8
   ...
end
Run Code Online (Sandbox Code Playgroud)