Created
June 17, 2022 16:55
-
-
Save zelaznik/899f91990001b7bc9cb8853cfc0d180d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
function find_existing_files() { | |
# This prevents me from shooting myself in the foot when I'm | |
# grepping for a pattern and forget to include "-l" before | |
# using xargs to open the files in sublime | |
for filepath in $@; do | |
if [ -f $filepath ]; then | |
echo $filepath | |
fi | |
if [ -d $filepath ]; then | |
echo $filepath | |
fi | |
done | |
} | |
/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl $(find_existing_files $@) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment