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.
11 Answer
It works with
a=0
PROMPT_COMMAND='echo -n $((a++))'after you open a new shell (or source .bashrc by calling . ~/.bashrc.