Skip to content

Instantly share code, notes, and snippets.

@nacho4d
Last active August 29, 2015 14:10
Show Gist options
  • Save nacho4d/76b7ab0856c54be0f5cd to your computer and use it in GitHub Desktop.
Save nacho4d/76b7ab0856c54be0f5cd to your computer and use it in GitHub Desktop.
find and open in emacs
#! /bin/bash
# Place this file somewhere in your $PATH and chmod +x it!
function usage () {
echo "Usage:"
echo "femacs is 'find and open in emacs'"
echo "femacs requires 1 parameter. It basically does:"
echo " emacs \`find . -name [expression]\`";
}
set -e
if [ "$#" -ne 1 ]; then
usage
exit 1
fi
echo "find . -name $1"
findRes=`find . -name $1`;
success=$(echo $findRes | grep ".*")
#echo "find : " $success
if [ -z "$success" ]; then
echo "File not found. " $findRes
exit 1
fi
emacs $findRes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment