Andrew Asked: 2018-05-01 04:32:25 +0800 CST2018-05-01 04:32:25 +0800 CST 2018-05-01 04:32:25 +0800 CST How to assign variable to PROMPT_COMMAND 772 How can I increment a variable assigning its value to PROMPT_COMMAND variable? Inside .bashrc I created variable a and assigned value to 0 and then added this a=0 PROMPT_COMMAND=`((a++))` When I echo PROMPT_COMMAND it shows that it is empty. bash prompt 1 Answers Voted Best Answer muclux 2018-05-01T05:16:34+08:002018-05-01T05:16:34+08:00 It works with a=0 PROMPT_COMMAND='echo -n $((a++))' after you open a new shell (or source .bashrc by calling . ~/.bashrc.
It works with
after you open a new shell (or source .bashrc by calling
. ~/.bashrc
.