diff options
| -rwxr-xr-x | st-cpycmd | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -5,7 +5,7 @@ # xclip required for this script. # By joe, adapted from st-cpyout by Jaywalker and Luke -mem=$(sed 's/^ $//g' | sed 's/\x0//g') +mem=$(sed '{s/^ $//g;s/\x0//g;}') ps1=$(printf "%s" "$mem" | tail -n1 | sed -E 's/([%,#,>,$]).*/\1/') @@ -15,7 +15,11 @@ chosen=$(printf "%s" "$mem" | tac | dmenu -i -l 10 -m 0) if [ -n "$chosen" ]; then - cmd=$(printf "%s" "$chosen" | sed "s/^$ps1 //") + cmd=$(printf "%s" "$chosen" | sed "{s/^$ps1 //;s/ $//;}") printf "%s" "$cmd" | xclip -selection clipboard - herbe " clipped : $(printf "%.10s..." "$cmd")" & + herbe=$(printf " clipped cmd : %.10s" "$cmd") + if [ "$(printf "%s" "$cmd" | wc -c)" -gt 10 ]; then + herbe="${herbe}..." + fi + herbe "$herbe" & fi |
