I am working in git-bash on windows and I am trying to configure my bash prompt so that it displays like:
username: <custom abbreviated form of pwd>
$
To generate my custom abbreviated form of pwd I was going to substitute my own custom script into PS1 as follows:
PS1="\u: \$(<custom_script.sh>) \n \$ "
However, this PS1 definition seems to generate error messages each time a new prompt is displayed. What is interesting is this error does not appear when the new line character is removed!
For example, consider the test I did using the date command:
$ PS1="\u: \$(date) \$ "
Former: Wed, Apr 18, 2018 5:09:37 PM $
Former: Wed, Apr 18, 2018 5:09:42 PM $ PS1="\u: \$(date) \n \$ "
bash: command substitution: line 1: syntax error near unexpected token `)'
bash: command substitution: line 1: `date)'
Former:
$
Prompt dislays fine when \n isn't before the \$, but gives error messages when included.
How do I get rid of the error messages?