From 1d9b6107e0d2efd2af58c8848254f27d2cfb189b Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 26 Apr 2023 16:17:58 +0200 Subject: bash: support copy alias on multiple platforms --- %HOME%/.bashrc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to '%HOME%') diff --git a/%HOME%/.bashrc b/%HOME%/.bashrc index 561eef9..56dc679 100644 --- a/%HOME%/.bashrc +++ b/%HOME%/.bashrc @@ -95,7 +95,15 @@ alias tree='tree -a' alias sed='sed --follow-symlinks' -alias copy='xclip -sel clip' +# Use in a pipeline: +# command | copy +if os_is_linux; then + alias copy='xclip -sel clip' +elif os_is_cygwin; then + alias copy='cat > /dev/clipboard' +elif os_is_macos; then + alias copy='pbcopy' +fi # Make sure ssh-copy-id copies public keys along with their comments. alias ssh-copy-id='ssh-copy-id -i' -- cgit v1.2.3