Skip to content
Advertisement

Bash offer numberd results for selection to user

my script takes in a site name from the user.

JavaScript

Its then allows the user to checkout, edit, and commit changes to the file, via the script.

However, some sites have two to six files.

So the script lists them as follows

You have more than one Cambridge file.

Please pick from the following:

cambridge1

cambridge2

cambridge3

user enters the word cambridge[1-3]

However, I’d like to assign a value to each variable, i.e, as follows.

Please choose the option you want:

1). cambridge1

2). cambridge2

3). cambridge3

user enters 1, 2, or 3, and it picks up the file.

The current code I have is :

JavaScript

Advertisement

Answer

Here’s a fun way:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement