I have two git commands
git rev-parse --abbrev-ref HEAD
git for-each-ref --sort=-taggerdate --format '%(tag)' refs/tags/<<XX>>
I want output from first command to be used as substution for <> in second command. So far i'm writing the output of first command in a file and then using it in second.
Just wondering if there is a better way to do it.
git for-each-ref --sort=-taggerdate --format '%(tag)' refs/tags/$(git rev-parse --abbrev-ref HEAD)this is called command substitutionvar=$(git rev-parse --abbrev-ref HEAD), so by surrounding it with$(...)and you can use the value of the variable with$varmaking your second command:git for-each-ref --sort=-taggerdate --format '%(tag)' refs/tags/$var