0

I have created an alias gotochild2 in .bashrc file to change a particular path /parent/child1/child2. Now I want the user to enter his directory within child2 which will be dynamic. For example, gotodir files has to go /parent/child1/child2/files. How this can be specified in .bashrc?

Bodo
  • 9,287
  • 1
  • 13
  • 29
kushi
  • 67
  • 1
  • 2
  • 9

1 Answers1

2

Instead of an alias use a function if you want to pass a parameter like gotodir files.
See Make a Bash alias that takes a parameter?

gotodir () {
    cd "/parent/child1/child2/$1"
}
Bodo
  • 9,287
  • 1
  • 13
  • 29