.bashrc :
# some code before
export FLAG=$?
exec script :
~/.scripts/prompt.sh $FLAG
Pergunta
hey guys I'm having an issue passing a exit code from my ~/.bashrc file into another script continually (as in, a new code each time a command is executed). I currently have the following
.bashrc
generateFlag()
{
local flag="$?" ; PS1=''
}
PROMPT_COMMAND=generateFlag
. ~/.scipts/prompt.sh $flag
My prompt script is pretty much this
echo $1
Anyone know a way to get this working??
Solução
.bashrc :
# some code before
export FLAG=$?
exec script :
~/.scripts/prompt.sh $FLAG