I want pipe to cd by define a mycd function, expect using like this: echo workspace | mycd
this is how my function look like:
mycd(){
read path
cd $path && ls #The problem is (cd path) didn't get into the path, but (&& ls) is working good.
}
my test below shows that case 1 not able to change the path, but case 2 do.
1.
~ $ echo workspace | mycd
~ $
2.
~ $ mycd
workspace
~/workspace $