Andrew, et al -- ...and then Andrew DeFaria said... % % On 10/31/2012 11:23 AM, Brian Wilson wrote: ... % >${1}, ${2}, etc. Also, you may want to read up on the getopts command as a % >way to process command line arguments. % Technically, the {}'s are not needed. You can access them with $1, $2, ... % "/path/to/$1.save/dir" but not "/path/to/$1save/dir" you'd need the {} % (i.e. "/path/to/${1}save/dir" because otherwise the shell would be % looking for "1save" as an env variable name.
... except that environment variables cannot begin with numbers :-) davidtg@madi:~ > cat /tmp/numvars.sh bash --version save=x echo $save 1save=y echo $1save echo ${1save} davidtg@madi:~ > bash -x /tmp/numvars.sh + bash --version GNU bash, version 2.05a.0(1)-release (i386-portbld-freebsd4.6) Copyright 2001 Free Software Foundation, Inc. + save=x + echo x x + 1save=y /tmp/numvars.sh: 1save=y: command not found + echo save save /tmp/numvars.sh: ${1save}: bad substitution % -- % Andrew DeFaria <http://defaria.com> % Fear has its use but cowardice has none. - Mohandas Gandhi HTH & Happy Hallowe'en :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt
pgpoqybFn78I2.pgp
Description: PGP signature