Skip to content

Instantly share code, notes, and snippets.

@seahal
Created December 31, 2021 08:38
Show Gist options
  • Save seahal/389bf6f97d0e51eee280a77df4eb8ba3 to your computer and use it in GitHub Desktop.
Save seahal/389bf6f97d0e51eee280a77df4eb8ba3 to your computer and use it in GitHub Desktop.
#!/bin/bash
# "0" と "0" の比較をすると、0 という値が返ってくる
test "0" == "0"
echo $?
# "0" と "1" の比較をすると、1 という値が返ってくる
test "0" == "1"
echo $?
# それはすなわち、bash では 0 は true で 1 は false なのではないか?
for i in {'0','1'}; do
if test '0' == $i; then
echo "$? is true"
else
echo "$? is false"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment