Skip to content

Instantly share code, notes, and snippets.

@cowboy-cod3r
Created December 7, 2013 18:41
Show Gist options
  • Save cowboy-cod3r/7846817 to your computer and use it in GitHub Desktop.
Save cowboy-cod3r/7846817 to your computer and use it in GitHub Desktop.
Bash: Prompt for Input
# Ask use for input
# -e - if standard input is coming from a terminal, readline is used to obtain the line
# -p - display prompt on stderr without a trailing new line
default="/usr/locol/etc/"
read -e -p "Enter the path to the file [${default}]: " FILEPATH
FILEPATH=${FILEPATH:-${default}}
echo $FILEPATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment