Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

I have been studying bash recently.

I need a bash code that displays a list of files in the current directory and prompts for which file to execute.

If the user enters a valid choice, then the executable file selection should be invoked.

share|improve this question

closed as not a real question by Paul, Diogo, Sathya Nov 17 '11 at 14:36

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Please show some effort. If you've been studying bash, then you must have at least some progress toward a solution? – Andrew Schulman Nov 17 '11 at 10:21
Well, there's their previous question: select files from a set. – slhck Nov 17 '11 at 10:27
-1 Question does not show any research effort. – Daniel Beck Nov 17 '11 at 11:03
Neither did the previous one, 5 hours prior. Vote to close. Again. @user105716, please come back when you get stuck, not when you get started. – Paul Nov 17 '11 at 12:34

To get you started, look up these constructs in the bash manual.

select file in *

if [[ -x "$file" ]]

exec "$file"
share|improve this answer
heh, looks a little like SQL, I thought you were kidding for a moment, i'll have to study bash a bit again too! – barlop Nov 17 '11 at 13:55

Not the answer you're looking for? Browse other questions tagged .