Command Line Simplified - Symfony Alias

I’m tired to rewrite everytime “./symfony …”, really, I do it a lot of times! So I optimized it, let’s go. First you need to do a alias to symfony, to execute ./symfony from any directory.

Create a file /usr/local/bin/sf

while [ 1 ]; do
    if [ -f 'symfony' ]; then

        ./symfony $*
        exit $?
    fi

    cd ..
    if [ "$PWD" = "/" ]; then

        echo ‘cannot find symfony project directory’
        exit 1

    fi
done

There are some snippet liek it on symfony-project.com, but I’ve changed a little to run here.

After, you can work with alias as you want. I created the following option:

alias sf-restart='sf doctrine:build-all-load --no-confirmation; sf cc '

So, you can use the sf-restart to use less lines in your job.

The pattern to create alias is following.

at prompt use:
alias cds='cd /etc/rc.d/init.d ; ls'

explaining: alias name='comand ; comand2 ; comand3'

Respond to this post