aboutsummaryrefslogtreecommitdiffstats
path: root/st-cpycmd
diff options
context:
space:
mode:
Diffstat (limited to 'st-cpycmd')
-rwxr-xr-xst-cpycmd10
1 files changed, 7 insertions, 3 deletions
diff --git a/st-cpycmd b/st-cpycmd
index ece0c21..3fb38c4 100755
--- a/st-cpycmd
+++ b/st-cpycmd
@@ -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