463 current 2025-06-28 22:07:32 25.05.20250424.f771eb4 6.12.24 *
This commit is contained in:
20
home/scripts/fullclip.sh
Normal file
20
home/scripts/fullclip.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
tmpfile=$(mktemp)
|
||||
trap 'rm -f "$tmpfile"' EXIT
|
||||
|
||||
if (( $# == 0 )); then
|
||||
printf 'usage: %s command [arg …] — or — %s "full pipeline"\n' "$0" "$0" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (( $# == 1 )); then
|
||||
bash -c "$1" >"$tmpfile"
|
||||
else
|
||||
"$@" >"$tmpfile"
|
||||
fi
|
||||
|
||||
data=$(cat "$tmpfile")
|
||||
op="$*"
|
||||
echo -e "\$ $op\n$data" | perl -p -e 'chomp if eof' | xclip -in -sel clip
|
||||
rm "$tmpfile"
|
||||
Reference in New Issue
Block a user