prompt.bash 472 B

123456789101112131415
  1. # Functions used in building the command prompt.
  2. # Display suspended/backgrounded job count, if any.
  3. function getajob() {
  4. local jobcount=$(jobs | wc -l)
  5. [[ $jobcount -ne 0 ]] && printf " ${FG[63]}[jobs]: ${FG[1]}\j" || printf ''
  6. }
  7. # Display up to 3 segments of the current working directory.
  8. function shortcwd() {
  9. local folder=$(pwd) fld='[^/]*'
  10. folder=${folder/$HOME/"~"}
  11. folder=$(echo $folder | sed 's|.*/\('$fld'/'$fld'/'$fld'\)|\1|')
  12. printf "$folder"
  13. }