#!/bin/bash function usage { echo -e ' Copy image to clipboard Usage: img2clip path-to-image ' } while getopts h opt do case "$opt" in h) usage exit ;; esac done if [[ -z "$1" ]]; then usage exit fi mime=$( file -b --mime-type "$1" ) xclip -selection primary -t "$mime" -i "$1" xclip -selection clipboard -t "$mime" -i "$1"