-
-
Save vor0nwe/4c9a2561d79a833abe4f10e9f17d6002 to your computer and use it in GitHub Desktop.
clip: WSL bash script to access the Windows Clipboard (both read and write)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[[ ! -t 1 ]] && powershell.exe Get-Clipboard | |
[[ ! -t 0 ]] && clip.exe | |
if [[ -t 1 && -t 0 ]]; then | |
echo Nothing specified to copy or paste! >&2 | |
exit 1 | |
fi |
Exactly what I was looking for. Thanks 😊.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Save this gist to a file called
clip
somewhere in your$PATH
, and make executable withchmod u+x clip
.You can then redirect stuff from and to
clip
, or pipe toclip
.To sort a bunch of text you've copied:
clip | sort
or plain dump the text on the clipboard into a file:
clip > clipboard.txt
To copy the contents of a file to the clipboard: