1 개요[ | ]
- array in sh
- sh foreach 스타일
Bash
Copy
#!/bin/sh
set -- "John Smith" "Jane Doe" "Mike Barnes" "Kevin Patterson"
while [ $# -gt 0 ]; do
echo [$1]
shift; done
# [John Smith]
# [Jane Doe]
# [Mike Barnes]
# [Kevin Patterson]
Bash
Copy
#!/bin/sh
AAA='"John Smith" "Jane Doe" "Mike Barnes" "Kevin Patterson"'
eval set $AAA
while [ $# -gt 0 ]; do
echo [$1]
shift; done
# [John Smith]
# [Jane Doe]
# [Mike Barnes]
# [Kevin Patterson]
2 같이 보기[ | ]
3 참고[ | ]
편집자 Jmnote
로그인하시면 댓글을 쓸 수 있습니다.