[SLUG] HELP: Shell Programming and Command Line Parameters

From: Jeff Barriault (jeffbarr@tampabay.rr.com)
Date: Fri Nov 01 2002 - 14:49:21 EST


I have a script that's not working and I think I know why, but I just don't
know how to fix it.

Basically I'm trying to extract the command line parameters. For example: -h
hostname -n username -w 80 -x 0 -y 0 acct

Only problem is the actual parameters are passed without a space. For
examle: -hhostname -nusername -w80 -x0 -y0 acct

Here is a script that works with the spaces:

# retrieve the username and hostname from the paramaters
while :
do
    case "$1" in
        -n) Username="$2"
            shift ; shift
            ;;
        -h) Hostname="$2"
            shift ; shift
            ;;
       -*) shift
            ;;
        *) break
    esac
done

Anyone know what I need to do to modify it to work without the spaces?

By the way, this is comming from a Samba printer share that redirects the
output file into a script. If there is a setting somewhere in Samba to get
it to add spaces to it's command line parameters that would probably fix it
too.

Thanks!



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:43:57 EDT