Friday, April 28, 2017

Script:- if test, usage

usage()
{
    echo "Usage: $command [-i|-u|-b|-h  ]"
    echo "-i : fresh install "
    echo "-u : upgrade install"
    echo "-b :Upgrade Agent only , no server info will be updated"
    echo "-h : show this help"
}

user=`id | cut -d'=' -f2 | cut -d\( -f1`
if [ $user -ne 0 ]; then
    echo "This package needs root authentication to install."
    exit 1
fi
###Validation: No args, go away
if [ $# -eq 0 ]; then
    usage
    exit 1
fi

No comments:

Post a Comment