Skip to content

Instantly share code, notes, and snippets.

@zewebdev1337
Created October 21, 2024 20:37
Show Gist options
  • Save zewebdev1337/b042fde3ce2eb4637d0601de159c33c3 to your computer and use it in GitHub Desktop.
Save zewebdev1337/b042fde3ce2eb4637d0601de159c33c3 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Check if a filename is provided
if [ -z "$1" ]; then
echo "Usage: $0 <filename>"
exit 1
fi
# Use the provided filename
filename="$1"
# Check if the file exists
if [ ! -f "$filename" ]; then
echo "File not found: $filename"
exit 1
fi
# Copy the content of the file to the clipboard
cat "$filename" | xclip -selection clipboard
echo "Content of $filename copied to clipboard."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment