Skip to content

Instantly share code, notes, and snippets.

@chawkinsuf
Created September 4, 2014 18:17
Show Gist options
  • Save chawkinsuf/735726b1d2aa41029071 to your computer and use it in GitHub Desktop.
Save chawkinsuf/735726b1d2aa41029071 to your computer and use it in GitHub Desktop.
Check only the first character of a response
isyes=
read -p"Do you want to? " answer
if [[ ${answer:0:1} == 'y' || ${answer:0:1} == 'Y' ]]; then
isyes=1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment