This question already has an answer here:
I am trying to create an alias which when given some argument will look for the folder with contains the argument as pattern. Let the alias name be
Now, I will be using this alias like
gohf <some-pattern>, for eg.
gohf testing. Now this should look for a folder that contains “testing” in its name and take me to that folder in the last step.
Following is what I could think of.
alias gohf='cd `find . -type d | grep testing`';
The above alias works when the pattern is always “testing”.
How can I modify so that if the alias is used as say
gohf game, then the alias should take me to the folder that contains game in its name.
I am assuming that there is only one folder for each pattern I input.