Jeffrey Pyne a écrit : > How about using the "shift" shell builtin? It moves $2 to $1, $3 to $2, > etc. For example: > > while [ "$#" -ne 0 ] > do > case "$1" in > noblah) > echo Not doing blah. > ;; > *) > echo Doing blah; > ;; > esac > case "$1" in > nothis) > echo Not doing this. > ;; > *) > echo Doing this > ;; > esac > > shift > done > > Also, depending on what you are doing, the "getopts" shell builtin may be > able to help. Documentation for shift and getopts can be found in the > bash(1) manpage. > > Hope that helps, > ~Jeff > > On Monday, July 29, 2002 12:37 PM, Bryce C wrote: > > > Can anyone tell me how, in a bash script, I can move the contents of > > variable $2 to variable $1 and so on? I'm writing a bash script to > > update some stuff but I'd like to be able to type > > script.sh noblah noit nothat > > but everything is defaulted yes. > > Currently., my script is something like > > case "$1" in > > noblah) > > echo Not doing blah. > > $1="$2" > > ;; > > *) > > echo Doing blah; > > ;; > > esac > > case "$1" in > > nothis) > > echo Not doing this. > > $1="$2" > > ;; > > *) > > echo Doing this > > ;; > > esac > > > > That sort of thing. Can anyone help? Perhaps a nice online > > reference? > > No books though, I don't have the money or time to buy one. > > > > Thanks, > > -- > > Bryce Chidester > > Network Administrator > > CoBryce Communications > > Bryce AT BryceCo DOT Net > > http://www.bryceco.net > > > > ________________________________________________ > See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail > doesn't post to the list quickly and you use Netscape to write mail. > > PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss Bryce C. Network Administrator CoBryce Communications Bryce@BryceCo.Net http://www.BryceCo.Net