I need a Shell Script that looks at the specified directory and assigns the name of the last modified subdirectory to a specific variable.
I can get the name of the latest subdirectory in /apps/ like this:
cd /apps
ls -td -- */ | head -n 1 | cut -d'/' -f1
But how do I assign the result of the second command to a variable, so I can use the parameter in the further script commands (e.g. mkdir $variable)?