I'd like to ls for the latest created directory in a given directory (we create a new folder for each release) and then cd to that directory. I'd like to create an alias for this so I don't have to remember how to get to the latest directory every time I need to.
Here's what I've tried:
ls -ltr ~/workspace/docs/new-docs/Mapper/Documentation/ | tail -1 | cd
cd $(ls -ltr ~/workspace/docs/new-docs/Mapper/Documentation/ | tail -1)
the problem seems to be that if I order the results I end up with the permissions on the file as output. Any help is greatly appreciated!
UPDATE:
$cd `ls -dt ~/workspace/docs/new-docs/Mapper/Documentation/* | head -1`
-bash: cd: drwxr-xr-x: No such file or directory