Created
April 16, 2025 22:46
-
-
Save changx03/e7a93bb2e0a277753af20400711618ab to your computer and use it in GitHub Desktop.
bash example for matching 1 and 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!bin/bash | |
DEV=0 | |
if [ "$#" -eq 1 ]; then | |
DEV="$1" | |
fi | |
# Expceting: | |
# bash ./test.bash 1 -> match | |
# bash ./test.bash "1" -> match | |
# bash ./test.bash 2 -> not match | |
# bash ./test.bash true -> not match | |
if [ "$DEV" = "1" ]; then | |
echo "MATCH! DEV is 1!" | |
else | |
echo "DEV is $DEV" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment