view .bash_mozilla @ 553:752e5eea7ea8

.bash_mozilla
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 19 Nov 2013 13:09:36 -0800
parents 029c7c2c511d
children 8ef38b16dcb9
line wrap: on
line source

#!/bin/bash

# mozilla-specific bash customizations

MOZCONFIGS=${HOME}/mozilla/mozconfigs

mozconfig() {

if [ ! -e ${MOZCONFIGS} ]
then
    echo "MOZCONFIGS directory ${MOZCONFIGS} does not exist"
    return 1
fi

if [[ "$#" == "0" ]]
then
    # list the available configs
    ls -1 ${MOZCONFIGS} | sort
elif [[ "$#" == "1" ]]
then
    # activate the chosen mozconfig
    name=$1
    for _MOZCONFIG in "${MOZCONFIGS}/${name}" "${MOZCONFIGS}/mozconfig.${name}"
    do
        if [[ -e "${_MOZCONFIG}" ]]
        then
            echo "Using MOZCONFIG : ${_MOZCONFIG}"
            break
        fi
    done
    if [[ ! -e "${_MOZCONFIG}" ]]
    then
        echo "MOZCONFIG ${name} not found"
        return 1
    fi
else
    # print usage
    echo "Usage: mozconfig <configname>"
    return 1
fi

}