?
Solved

Asking for a path in a bash shellscript with tab completion

Posted on 2003-03-27
5
Medium Priority
?
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

765 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