Question

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??

Était-ce utile?

La solution

.bashrc :

# some code before
export FLAG=$?

exec script :

~/.scripts/prompt.sh $FLAG
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top