Sample Header Ad - 728x90

Check if a number is in a range with zsh

3 votes
2 answers
1278 views
Why is passing 0 as an argument results in a false positive (prints "True")?
#!/bin/zsh

k="$1"

if ((0 < k < 1))
then
    echo "True"
fi
Note this script is called stitch_applier.sh Terminal
% ./stitch_applier.sh 0
True
This was run on a Linux system.
Asked by visual360 (41 rep)
Apr 20, 2021, 10:41 AM
Last activity: Jul 7, 2025, 04:30 PM