I want to go in the directory on the basis of highest directory number.
Path: /home/cg/root/2018/01
. Inside this path I have multiple directories as below
15
16
17
So on..
In this case highest directory is 17
so I want to move in 17
directory... If a directory named 18
exists then want to go in 18
.
Is there any way which can be done using the cd
command?
Like :
cd /home/cg/root/2018/01/$(ls |tail -1)
cd $(zsh -c 'echo *(/on[-1])')