For a specific directory, how can I get the names of the child directories in the list?
Use glob . For example, for the current directory, the command to get all the subdirectories
glob -type d *
Or, if you need a specific directory, use the -directory option :
glob -directory $mydir -type d *