philip@cel.cummins.com (Philip D. Pokorny) (06/15/91)
I must be getting old... I can't remember if I posted this to the newsgroup, or who the original requestor was... One of my sys_admin cohorts, came up with this code that he believes he got at ADUS from a shell lecture... #!/com/sh # eon # My original posting???? n := 0 while (( ^"set -c args @"@^^n@"" <> "" )) do arg := ^"set -c args @^^n" args (( "Argument " + ^n + ": " + ^arg )) n := ^n + 1 enddo # New and improved posting... args "" "" n := 0 while not set -c "eqs ^^n" do set -c "arg := ^^n" args (( "Argument " + ^n + ": " + ^arg )) n := ^n + 1 enddo # Shell class example: args "" "" # Count arguments... i := 0 while not set -c "eqs ^^i" do # Create "array" set -c "argv^i := ^^i" i := ^i +1 enddo # Save number of arguments... argc := ^i -1 # for i := 0 to ^argc # Get argument from "array" set -c "arg := @^argv^i" args (( "Argument " + ^i + ": " + ^arg )) n := ^n + 1 endfor # Dump variables to prove we worked... args "" "" lvar :)