If I know there will be a single folder inside a directory, but I do not know it's name, is there a simple way in bash to go into it? If I wanted to do a check to make sure a folder exists within the current directory, can that be done?
If there is only one sub-directory inside your current path then you can use this glob pattern to do cd
:
cd */
Pattern */
matches all the sub-directories from current path and since there is only one so this cd
will just change directory to single sub-directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With