Last active
April 17, 2024 21:06
-
-
Save markjaquith/4500280 to your computer and use it in GitHub Desktop.
Bash command to fix a quirk with Sublime Text 2's "subl" command. Sometimes, when using it, under hard-to-pinpoint circumstances, it will open up Sublime Text 2 completely blank (i.e. the file you asked it to open will not be open). This snippet fixes that by essentially kicking subl under the table to wake it up and then passing on the command …
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
function subl() { | |
if [[ ! -p /dev/stdin ]]; then | |
command subl > /dev/null 2>&1 | |
fi | |
command subl "$@" | |
} |
Oh man, thank you so much for this. That used to be such a PITA.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice. I do think that checking whether standard input is redirected (i.e., stdin isn't the terminal but comes from a pipe or a redirected file) is more portably done via
test -t 0
. Thus