# so I've thrown a bunch of things at the wall to speed it up.
prompt-command() {
local return=$? # this MUST COME FIRST
- local h
- local jobs_char
+ local h jobs_char prtmp
PS1='\w'
if [[ $SSH_CLIENT ]]; then
local ps_char ps_color col tmp h
-
# note, I tried reading the current column here in order to add a
# space if there was non-newline terminated output from the last
# command. However, I found that it made ssh escape char not
# history which won't actually get saved.
if [[ $h != "$_sl_last_history" && $h =~ $cmd_regex ]]; then
_sl_last_history="$h"
- ("${_sl_hist_cmd[@]}" <<<"$h" &)
+ ( "${_sl_hist_cmd[@]}" <<<"$h" & )
fi
else
- _sl_last_history="$(history 1)"
+ _sl_last_history="$(history 1 | sed -r 's/^ *([^ ]+ +){4}//')"
_did_ssh_prompt1=t
fi
fi
fi
-
-
# if we aren't in ssh, maybe indicate history file
if [[ ! $SSH_CLIENT ]]; then
if [[ -e $HOME/.iank-stream-on ]]; then
if [[ $MAIL_HOST && $MAIL_HOST != "$HOSTNAME" ]]; then
ps_char="@ $ps_char"
fi
- if [[ $(jobs -p) ]]; then
- jobs_char='j\j '
+ # trivia: without -r or -s, jobs will print jobs listed as Done
+ # (they dont exist as of a short time ago). And strangely, this will
+ # happen for jobs that bash never reported as existing before that,
+ # eg ( sleep 10 & ).
+ prtmp=$(jobs -s; jobs -r)
+ if (( ${#prtmp} != 0 )); then
+ # printf "prtmp'%s'\n" "$prtmp" # # debug
+ jobs_char="j\j "
fi
-
# allow a function to specify a command to run after we run the next
# command. Use case: a function makes a persistent notification. If
# we happen to be using that terminal, we can just keep working by
if [[ $(type -t ps-extra 2>/dev/null) == function ]]; then
ps-extra
fi
+
PS1="$PS1 $jobs_char$psudo\[$ps_color\]$ps_char\[$term_nocolor\] "
# copy of what is automatically added by guix.