Skip to content

Instantly share code, notes, and snippets.

@quark-zju
Created May 28, 2015 08:43
Show Gist options
  • Save quark-zju/796ddadd9bf3e87cde36 to your computer and use it in GitHub Desktop.
Save quark-zju/796ddadd9bf3e87cde36 to your computer and use it in GitHub Desktop.
copy-paste.sh
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