aboutsummaryrefslogtreecommitdiffstats
path: root/st-cpyout
diff options
context:
space:
mode:
authorjoe <rbo@gmx.us>2025-10-08 17:17:33 +0200
committerjoe <rbo@gmx.us>2025-10-08 17:17:33 +0200
commitc0f4fe5179047e64ab793e798bbf6189fb99db8f (patch)
tree6120306758c4e0c9f1d912e6c7b99bca6ef2f1fe /st-cpyout
parentnice (diff)
downloadst-c0f4fe5179047e64ab793e798bbf6189fb99db8f.tar.gz
st-c0f4fe5179047e64ab793e798bbf6189fb99db8f.tar.bz2
st-c0f4fe5179047e64ab793e798bbf6189fb99db8f.tar.xz
st-c0f4fe5179047e64ab793e798bbf6189fb99db8f.tar.zst
st-c0f4fe5179047e64ab793e798bbf6189fb99db8f.zip
up
Diffstat (limited to 'st-cpyout')
-rwxr-xr-xst-cpyout14
1 files changed, 7 insertions, 7 deletions
diff --git a/st-cpyout b/st-cpyout
index c1fa1a1..09712c7 100755
--- a/st-cpyout
+++ b/st-cpyout
@@ -5,28 +5,28 @@
# xclip required for this script.
# By Jaywalker and Luke
# Adapted for FreeBSD by Joe
-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/')
chosen=$(printf "%s" "$mem" |
grep -F "$ps1" |
- sed '$ d' |
+ grep -v "$ps1 $" |
tac |
- dmenu -i -l 10 -m 0 |
+ dmenu -i -l 10 |
sed 's/[^^]/[&]/g; s/\^/\\^/g')
eps1=$(echo "$ps1" |
sed 's/[^^]/[&]/g; s/\^/\\^/g')
if [ "$1" = "noprompt" ]; then
printf "%s" "$mem" |
gawk "/^$chosen$/{p=1;print;next} p&&/$eps1/{p=0};p" |
- tac |
- sed '$ d' |
- tac |
- perl -p -e 'chomp if eof' |
+ sed '{1d;s/ $//;}' |
+ head -c -1 |
xclip -selection clipboard
else
printf "%s" "$mem" |
gawk "/^$chosen$/{p=1;print;next} p&&/$eps1/{p=0};p" |
+ sed 's/ $//' |
+ head -c -1 |
xclip -selection clipboard
fi