I am using bash shell in Unix and within bash profile [.bashrc] I have created few aliases to navigate to different directories.
My requirement is to pass that alias name as parameter to a function and use alias to navigate to that directory inside the function.
So I have following things inside .bashrc:
alias nav='cd /app/nav/'
function test(){
$1;
}
Now I run this command test nav but the alias doesn't work inside the function.
Any suggestions on how to get this going?
CDPATH=:/app. Now you can just typecd navand it will take you to/app/navunless you happen to have a sub-directorynavin the current directory. When it usesCDPATH, the shell tells you which directory it changed to.nav() { cd /app/nav; }(one character shorter, in fact).