은 필자가
if [ $# -eq 1 ]; then
echo "usage: Phar ~/flashmem ~/archive"
exit
fi
필자가 건너 결코 코드 건너 [$ # -eq 1] 나는 의미 (Special Parameters에서 man bash
에서 복사) 그것은 Expands to the number of positional parameters in decimal.
은 필자가
if [ $# -eq 1 ]; then
echo "usage: Phar ~/flashmem ~/archive"
exit
fi
필자가 건너 결코 코드 건너 [$ # -eq 1] 나는 의미 (Special Parameters에서 man bash
에서 복사) 그것은 Expands to the number of positional parameters in decimal.
은 "$ #을"인자로 전달 된 매개 변수의 수를 반환
#!/bin/bash
echo $#
이제
./testess.sh test1 test2 test3
이 반환 3
./testess.sh test1 test2 test3 test4 test5
이 반환 5
코드에서 "$ #"이 1과 같으면 (단 하나의 인수가 전달됨) echo 명령을 실행하십시오.
불행히도, [bash manual] (http://www.gnu.org/software /bash/manual/html_node/index.html)이 쓰여지면 '$ #'와 같은 것을 찾기가 어렵다. 왜냐하면'$'없이 표시되기 때문이다. '$ *','$ @','$ #'등과 같은 소위 "특수 매개 변수"는 [3.4.2 절, 특수 매개 변수]에 있습니다 (http://www.gnu.org/software/bash /manual/html_node/Special-Parameters.html). –
또한 Google이 man (1) bash보다 더 적극적으로 기호를 제거하는 데 도움이되지 않습니다. – kojiro