views:

24

answers:

1

I am using mac.

When I do

p demo

on my terminal then I want to go to

cd /Users/dorelal/prod_demo

I tried adding following commands to my ~/.bashrc but none of them worked.

alias p='cd /Users/dorelal/prod_$1'

function p {
  cd '/Users/dorelal/prod_$1'
}
+5  A: 

This should work

p() {
  cd "/Users/dorelal/prod_$1"
}

Note the double quotes, rather than single quotes, to allow expansion of the $1.

roe