tag:blogger.com,1999:blog-6194839.post111695227923103891..comments2023-09-28T19:11:49.467+05:30Comments on Balbir's Blog: If you use a shellBalbirhttp://www.blogger.com/profile/17752733091129859385noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-6194839.post-1117521307657431652005-05-31T12:05:00.000+05:302005-05-31T12:05:00.000+05:30Okay :)Okay :)Hhttps://www.blogger.com/profile/16357617158381106368noreply@blogger.comtag:blogger.com,1999:blog-6194839.post-1117519952602130412005-05-31T11:42:00.000+05:302005-05-31T11:42:00.000+05:30cd ${PWD/$1/$2} is used for substitution. It does ...cd ${PWD/$1/$2} is used for substitution. It does not concatenate the string. So basically def gets replaced by jkl in the new string and cd will actually take you to the second directoryBalbirhttps://www.blogger.com/profile/17752733091129859385noreply@blogger.comtag:blogger.com,1999:blog-6194839.post-1117485647774491002005-05-31T02:10:00.000+05:302005-05-31T02:10:00.000+05:30I'm no shell expert, but my 2 cents:-2) builtin cd...I'm no shell expert, but my 2 cents<BR/>:-<BR/><BR/>2) builtin cd ${PWD/$1/$2}<BR/><BR/>The case2 seems to have a problem <BR/>Example :- I'm currently in /usr/local/abc/def/ghi<BR/><BR/>and I have a directory called /usr/local/abc/jkl/ghi<BR/><BR/>so a cd def jkl will be case 2) pwd will return /usr/local/abc/def/ghi and you are now trying to do a cd /usr/local/abc/def/ghi/def/jkl <BR/><BR/>this may not work.Hhttps://www.blogger.com/profile/16357617158381106368noreply@blogger.com