new script: copy
β’ 162 words β’ 1 min β’ updated
I decided to add a new copy script to
pancake to standardize copying command
output and files to the system clipboard in both macOS and Linux.
The idea was originally inspired by Evan Hahn:
copyandpastaare simple wrappers around system clipboard managers, likepbcopyon macOS andxclipon Linux. I use these all the time.
Evan’s version is concise and elegant.
My version is more verbose, for the sake of consistency with the rest of my scripts in pancake.
Usage #
bash
# Copy from stdin
echo "BANANA42SPLIT88SUNDAE99CHERRY" | copy
# Copy a file
copy notes.txt
# Copy multiple files
copy *.mdPlatform Support #
- macOS: Uses
pbcopy(built-in) - Linux: Auto-detects first available tool:
β
wl-copy(Wayland) β prioritized for modern desktops βxclip(X11) βxsel(X11)
Features #
- Silent on success (Unix philosophy)
- Supports stdin input
- Supports single or multiple files
- Multiple files are concatenated with newline separators
- Clear error messages for missing files or dependencies
Backlinks
- realpath (Nov 20, 2025)
- new script: PDF remove password (Nov 16, 2025)