Skip to content

Add an option for non-error exit status mark + customization #150

Answered by akinomyoga
eadmaster asked this question in Q&A
Discussion options

You must be logged in to vote

If you want to print the exit status for both cases of successful execution and failure, you may turn off the exit-status display from ble.sh by setting an empty string to bleopt exec_errexit_mark and instead print one by yourself. You can print your own exit-status information via whatever you like such as blehook POSTEXEC, PS1, or PROMPT_COMMAND. Here's an example using blehook POSTEXEC:

# blerc

# Turn off the exit status [ble: exit $?] by ble.sh
bleopt exec_errexit_mark=

# Print status
print-exit-status() {
  local exit=$?
  if ((exit==0)); then
    echo $'status: \e[32m0 ♥\e[m'
  else
    echo $'status: \e[31m'"$exit"$'\e[m'
  fi
}
blehook POSTEXEC=print-exit-status

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by akinomyoga
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants