Last active
August 29, 2015 14:10
-
-
Save nacho4d/76b7ab0856c54be0f5cd to your computer and use it in GitHub Desktop.
find and open in emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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