Skip to content

Instantly share code, notes, and snippets.

@jubianchi
Created March 13, 2012 17:03
Show Gist options
  • Save jubianchi/2029937 to your computer and use it in GitHub Desktop.
Save jubianchi/2029937 to your computer and use it in GitHub Desktop.
## Lancez cette commande dans un tertminal
cat <<EOT | sudo tee /usr/local/bin/which_sf && sudo chmod +x /usr/local/bin/which_sf
#!/bin/sh
./symfony | perl -ne 'if( /^([a-zA-Z0-9\-]+)/ ) { \$first = \$1; } elsif ( /^\s*(:[a-zA-Z0-9\-]+)/ ) { print \$first . \$1 . "\n"; }' | grep \$1
EOT
##
##Usage :
which_sf foo
>>> foo:bar
>>> bar:foo
which_sf foo:
>>> foo:bar
./symfony "$(which_sf foo)"
>>> Lance la commande correspondant à la recherche si UN SEUL résultat est retourné (sinon, ERREUR ! :|)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment