#!/bin/sh set -e snipdir="__REPLACE__" act='type' while [ $# -gt 0 ] ; do case $1 in -s) snipdir="$2"; shift ; shift ;; copy) act='copy' ; shift ;; type) act='type' ; shift ;; *) break ;; esac ; done cd "$snipdir" _file=$(find -L . \! -type d | dmenu "$@") case $act in copy) xclip -selection clipboard < "$_file" ;; type) xdotool type --delay 1ms --clearmodifiers --file "$_file" ;; esac