Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

hey all i am attempting my first bash script. so i would like to prompt the user to find out where they would like a cloned repo to be saved

currently i am assigning it like this


is there some way to do it like this

read -e -p "Enter the path to the file: " -i "${HOME}/apps/" FILEPATH

but save the result as warpToLocation

sorry if this is a noobish question its brand new to me



echo "where would you like to install your repos?"

read -p "Enter the path to the file: " temp

warpInLocations=("git@github.com:cca/toolkit.git" "git@github.com:cca/sms.git" "git@github.com:cca/boogle.git" "git@github.com:cca/cairo.git")

echo "warping in toolkit, sms, boogle and cairo"
for repo in "${warpInLocations[@]}"
  if [ -d "$warpToLocation"]; then
    echo "somethings in the way.. $warpInDir all ready exists"
    git clone $repo $warpInDir


what i had done to get that error was add the code you gave me.

the issue with that is that -e(which allows you to edit the input with arrows) and -i(a preview/optional answer) runs on bash version 4 and higher and i am running version GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12).

so remove it. sorry i wasted all your time those who came to help me.

i should have done some homework before coming to you.

share|improve this question

What's wrong with

read -e -p "Enter the path to the file: " -i "${HOME}/apps/" warpToLocation


share|improve this answer
so FILEPATH is a variable. i thought it was a standard.. thanks man sorry its my first time dipping into bash i am scared i destroy my os – TheLegend May 24 '13 at 14:51
invalid option read: usage: read [-ers] [-u fd] [-t timeout] [-p prompt] [-a array] [-n nchars] [-d delim] [name ...] warping in toolkit, sms, boogle and cairo – TheLegend May 24 '13 at 14:53
I have no idea what you typed in your program, but I'm pretty sure that the command I told you works in bash. If you type something else and get error messages, it's fairly pointless to copy only the error message and hope that others can reconstruct your problem from that. – Uwe May 24 '13 at 15:05
that would be the result that bash gave me when i tried read -e -p "Enter the path to the file: " -i "${HOME}/apps/" warpToLocation – TheLegend May 24 '13 at 15:26
Your read doesn't have a -i option? Are you really using bash? Which version? bash --version – Uwe May 24 '13 at 15:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.