bash – Script that chooses one subdirectory in directory

Need to choose subdirectory in directory to use it.

I see it in this way.

  1. This is /SampleDir/ and it has /SubDir1/, /SubDir2/ and /SubDir3/

  2. User enter the directory location, program search it and give to user list of SubDirectories in this Dir, user choose with exactly subdir he want to work just click the number of list:

  3. Code

echo "–°hoose Directory:n"
read SOMEDIR
//  #check nubmber of subdirs
echo "In directory you have multiple subdir's, which one do you want to use"
// #choose subdir
// #Any operation, like Remove SubDir
  1. And same in Terminal

Choose Directory:

root@sampleuser:# /root/Documents/SampleDir/

In directory you have multiple subdir’s, which one do you want to use:

1]SubDir1

2]SubDir2

3]SubDir3

root@sampleuser:# 1

Thanks a lot