Skip to content

Instantly share code, notes, and snippets.

@firedynasty
Created April 14, 2023 17:40
Show Gist options
  • Save firedynasty/2e3b64a6c14d7bcf8b9cdfff91541354 to your computer and use it in GitHub Desktop.
Save firedynasty/2e3b64a6c14d7bcf8b9cdfff91541354 to your computer and use it in GitHub Desktop.
function get() {
if [[ $# -eq 0 ]]; then
echo "No file name provided."
echo "documents/forclipboard"
else
file_path="/Users/username/documents/forclipboard/${1}.txt"
if [ -f "$file_path" ]; then
cat "$file_path" | pbcopy
echo "File content copied to clipboard."
else
echo "File not found."
fi
fi
}
#this function is designed to copy to the clipboard contents of a text file if it exists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment