matching 되게 for loop 쓰는 법
글쓴이: chmod777 / 작성시간: 화, 2016/05/10 - 2:28오후
for x in 1 2 3 4 5 ;do
for y in 5 4 3 2 1 ;do
일 경우 결과는
x=1,y=5
x=1,y=4
x=1,y=3
x=1,y=2
x=1,y=1
x=2,y=5
x=2,y=4
x=2,y=3
x=2,y=2
x=2,y=1
... 이렇게 총 25개의 결과가 나오는데
저는
x=1,y=5
x=2,y=4
x=3,y=3
x=4,y=2
x=5,y=1
이렇게 5개의 결과가 나오기를 바랍니다..
Forums:


음 ..
되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』
음 ..
$ x=(1 2 3 4 5) $ y=(5 4 3 2 1) $ for ((i = 0; i < ${#x[@]}; i++)); do echo "x=${x[$i]}, y=${y[$i]}"; done x=1, y=5 x=2, y=4 x=3, y=3 x=4, y=2 x=5, y=1되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』