-
-
Save tarik02/1d2fa917b7d1aff511c53ba76c8577fa to your computer and use it in GitHub Desktop.
wsl polyfills
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 | |
if (( $# > 0 )); then | |
lovec.exe "$@" | |
else | |
lovec.exe . | |
fi | |
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 | |
POSITIONAL=() | |
while [[ $# -gt 0 ]] | |
do | |
key="$1" | |
case $key in | |
-out) | |
OUT=YES | |
shift | |
;; | |
*) | |
POSITIONAL+=("$1") | |
shift | |
;; | |
esac | |
done | |
set -- "${POSITIONAL[@]}" | |
if [[ $OUT == YES ]]; then | |
paste.exe | sed -e 's/\r//g' | |
else | |
cat | sed -e 's/\n/\r\n/g' | clip.exe | |
fi | |
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 | |
TEMP=`getopt -o afiocdpsbkxd:t:l:nhv --long append,follow,input,output,clear,delete,primary,secondary,clipboard,keep,exchange,display:,selectionTimeout:,logfile:,nodetach,help,verbose,version \ | |
-n 'xsel' -- "$@"` | |
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi | |
eval set -- "$TEMP" | |
POSITIONAL=() | |
while [[ $# -gt 0 ]] | |
do | |
key="$1" | |
case $key in | |
-i|--input) | |
INPUT=YES | |
shift | |
;; | |
-a|--append) | |
APPEND=YES | |
shift | |
;; | |
-f|--follow) | |
FOLLOW=YES | |
shift | |
;; | |
-o|--output) | |
OUTPUT=YES | |
shift | |
;; | |
-c|--clear) | |
CLEAR=YES | |
shift | |
;; | |
-d|--delete) | |
DELETE=YES | |
shift | |
;; | |
-x|--exchange) | |
EXCHANGE=YES | |
shift | |
;; | |
-p|--primary) | |
PRIMARY=YES | |
shift | |
;; | |
-s|--secondary) | |
SECONDARY=YES | |
shift | |
;; | |
-b|--clipboard) | |
CLIPBOARD=YES | |
shift | |
;; | |
-k|--keep) | |
KEEP=YES | |
shift | |
;; | |
-x|--exchange) | |
EXCHANGE=YES | |
shift | |
;; | |
-d|--display) | |
shift 2 | |
;; | |
-t|--selectionTimeout) | |
shift 2 | |
;; | |
-l|--logfile) | |
shift 2 | |
;; | |
-n|--nodetach) | |
shift | |
;; | |
-h|--help) | |
shift | |
;; | |
-v|--verbose) | |
shift | |
;; | |
--version) | |
shift | |
;; | |
*) | |
POSITIONAL+=("$1") | |
shift | |
;; | |
esac | |
done | |
set -- "${POSITIONAL[@]}" | |
if [[ $CLEAR == YES ]]; then | |
echo | clip.exe | |
fi | |
if [[ $INPUT == YES ]]; then | |
if [[ $APPEND == YES || $FOLLOW == YES ]]; then | |
(paste.exe; cat | sed -e 's/\n/\r\n/g') | clip.exe | |
else | |
cat | sed -e 's/\n/\r\n/g' | clip.exe | |
fi | |
elif [[ $OUTPUT == YES ]]; then | |
paste.exe | sed -e 's/\r//g' | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment