I wrote a shell script like this:
#! /bin/sh
...
ls | grep "android"
...
and the output is :
android1
android2
xx_android
...
I want to add a number in each file, like this:
1 android1
2 android2
3 XX_android
...
please choose your dir number:
and then wait for the user input line number x, the script reads the line number back then process the corresponding dir. How can we do this in shell ? Thanks !
Instead of implementing the interaction, you can use built-in command
select.