nixos-config/user/app/doom-emacs/scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh
2023-05-10 21:10:52 -05:00

11 lines
293 B
Bash
Executable file

#!/bin/sh
#command -v xclip >/dev/null 2>&1 || { echo "Need command xclip. Aborting." >&2; exit 1; }
if [[ -f "$1" ]]; then
TYPE=$(file -b --mime-type "$1")
xclip -selection clipboard -t "$TYPE" -i "$1"
else
echo $1 | xclip -selection clipboard -t text/plain &> /dev/null
exit
fi
exit