For workflow purposes I would like to write a bash script where I copy a file renaming it with the current date and current git branch name in its target, like this:
$ cp test.txt test-$(date +'%Y-%h-%d')-$(__git_ps1).txt
Say I'm in a branch named feature
, the output file name would be (date of today):
test-2017-Nov-5-feature.txt
For the date part (2017-Nov-5
), it works fine, but I'm having difficulties to output it along with the current git branch name via $(__git_ps)
What am I doing wrong? Thank you!