Created
May 28, 2015 08:43
-
-
Save quark-zju/796ddadd9bf3e87cde36 to your computer and use it in GitHub Desktop.
copy-paste.sh
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
copy () { | |
cat "$@" 2> /dev/null | xsel -b | |
local _path | |
for _path in "$@" | |
do | |
if [ "${_path[1]}" = '/' ] | |
then | |
echo "${_path}" | |
else | |
echo "${PWD}/${_path}" | |
fi | |
done > >(xsel -p) > >(xsel -s) | |
} | |
paste () { | |
local _srcpath | |
xsel -s | while read _srcpath | |
do | |
\cp -aivu "${_srcpath}" . | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment