?
Solved

Asking for a path in a bash shellscript with tab completion

Posted on 2003-03-27
5
Medium Priority
?
252 Views
Last Modified: 2006-11-17
I have a script that need to ask the user for the full path to a directory:

It's done like this:

echo -n "Enter path: "
read MY_PATH

The problem is that the user can't use tab completion when he/she enters the path.

Is there any way to invoke bash's tab completion when using the read function?

0
Comment
Question by:whiskeypop
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:majorwoo
ID: 8221957
i don't know the answer, (sorry), im posting so that when we do hear of one I get to know of it too, sounds like something that might be useful in the future you know?
0
 
LVL 2

Expert Comment

by:alain_tesio
ID: 8240526
the flag -e for the builtin read provides readline when the input is  a
0
 
LVL 2

Accepted Solution

by:
alain_tesio earned 150 total points
ID: 8240535
sorry, post too quickly :
when the input is a terminal, as described in the bash manpage :
read -e $mypath
0
 
LVL 9

Expert Comment

by:majorwoo
ID: 8240570
very cool good old man could have answered this one for us ;-)

(i wont point out that the $ with the read would break things though)
0
 

Author Comment

by:whiskeypop
ID: 8240700
Thanks for the answer!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question