"Sh foreach 스타일"의 두 판 사이의 차이

 
16번째 줄: 16번째 줄:
</source>
</source>


<source lang='console'>
<source lang='bash'>
#!/bin/sh
#!/bin/sh
AAA='"John Smith" "Jane Doe" "Mike Barnes" "Kevin Patterson"'
AAA='"John Smith" "Jane Doe" "Mike Barnes" "Kevin Patterson"'

2020년 5월 21일 (목) 15:40 기준 최신판

1 개요[ | ]

array in sh
sh foreach 스타일
#!/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]
#!/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 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}