I use a command to collect all my projects by searching for a common file (Jenkinsfile) because I want to execute a command in every project directory:
find . -name 'Jenkinsfile' | sed s/Jenkinsfile// | xargs -L 1 bash -c '(cd $0 && git branch)'
To shorten this for future usage I tried to create an alias for it like this:
alias fgb="find . -name 'Jenkinsfile' | sed s/Jenkinsfile// | xargs -L 1 bash -c 'cd $0 && git branch'"
But now I only get such error msgs:
./shared/authorization-provider/: line 0: cd: /usr/bin/bash: No such file or directory
What is wrong?
EDIT:
I found a solution:
alias fgb="find . -name 'Jenkinsfile' | sed s/Jenkinsfile// | xargs -I {} bash -c 'cd {} && pwd && git branch' "