Skip to content

Instantly share code, notes, and snippets.

@obfusk
Created August 2, 2020 20:13
Show Gist options
  • Select an option

  • Save obfusk/3caa8c38829895dfdbe3a8b6625e7004 to your computer and use it in GitHub Desktop.

Select an option

Save obfusk/3caa8c38829895dfdbe3a8b6625e7004 to your computer and use it in GitHub Desktop.
quick command line string equality test
#!/bin/bash
set -e
a="$1" b="$2"
if [ $# -lt 1 ]; then read -r -p "A: " && a="$REPLY"; fi
if [ $# -lt 2 ]; then read -r -p "B: " && b="$REPLY"; fi
test "$a" = "$b" && echo OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment