I would like to assign command (with pipe) output to a variable. The code is as follows. The goal of the code is to get the last folder folder with a particular name pattern.
Thanks for the feedback. I found that it was due to an error in the earlier lines of the code the ls command was not able to find any folders. The logic of the code posted is right.