--- riza x <[EMAIL PROTECTED]> wrote: > On Sun, 2006-08-13 at 14:05 +1000, Johannes Sasongko > wrote: > > > #!/bin/bash > > > # > > > # display_it.sh > > > # This script will display... err..well, im not > finish it yet :) > > > > > > declare -a ARGM > > > > > > echo "This script you are using is: $0" | sed > 's/.\///' > > > echo "You passed $# argument(s)." > > > while (( $# )); do > > > echo $1 > > > ARGM[$#]=$1; > > > shift > > > done > > > echo "Your argument are : ${ARGM[*]}" > > > > > > nah ketika di jalankan: > > > > > > [EMAIL PROTECTED]:~/doc/bash$ ./tmp.sh one two three > four five > > > This script you are using is: tmp.sh > > > You passed 5 argument(s). > > > one > > > two > > > three > > > four > > > five > > > Your argument are : five four three two one > > > > Jelas saja, kan > > ARGM[$#]=$1; > > jalannya dari belakang (pertama: $# = 5, kedua: $# > = 4, ...). > > > > keinginan saya adalah bagaimana argumen pertama > masuk ke array sebagai > yang pertama juga, bukan sebaliknya, hal ini sudah > saya pecahkan > sendiri : > > ARGM=($@) > > sehingga ARGM diisi dengan $1 $2 ... $($#) > > hanya saja saya masih bertanya-tanya bagaimana cara > nya memasukkan > argumen tersebut sesuai urutannya ke dalam array > sehingga jalan nya > tidak dari belakang lagi..?? > > > salam > ----- > It is not that polar co-ordinates are complicated, > it is simply that > cartesian co-ordinates are simpler than they have a > right to be. -- > Kleppner & Kolenhow, "An Introduction to Mechanics" > > http://rizahnst.afraid.org/ > > > -- > Berhenti langganan: > [EMAIL PROTECTED] > Arsip dan info: http://linux.or.id/milis > >
#!/bin/bash # # display_it.sh # This script will display... err..well, im not finish # it yet :) declare -a ARGM declare -i i declare -i n echo "This script you are using is: $0" | sed 's/.\///' echo "You passed $# argument(s)." i=0 n=$# while [ $i -lt $n ]; do echo $1 ARGM[$i]=$1 shift i=$i+1 done echo "Your argument are : ${ARGM[*]}" Sorry nih, gw juga masih newbie jadi sintaks bash nya masih gak bingung tapi code yang diatas bisa dipake kok. Send instant messages to your online friends http://uk.messenger.yahoo.com -- Berhenti langganan: [EMAIL PROTECTED] Arsip dan info: http://linux.or.id/milis