사용자 도구

사이트 도구


linux:bash

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
linux:bash [2017/01/03 13:13]
kwon37xi [16진수/10진수(hex/dec)간 변환]
linux:bash [2018/01/07 10:47]
kwon37xi
줄 65: 줄 65:
 #결과 #결과
 00099 00099
 +</code>
 +
 +bash 4.x 에서는
 +<code sh>
 +for i in {00..10}; do
 +  echo $i
 +done
 +# 결과
 +00
 +01
 +02
 +03
 +04...
 +</code>
 +
 ===== 변수에 값 입력 받기 ===== ===== 변수에 값 입력 받기 =====
 <code sh> <code sh>
줄 135: 줄 150:
 read varname # varname 으로 입력값 저장 read varname # varname 으로 입력값 저장
 read -p 'press enter' varname # prompt read -p 'press enter' varname # prompt
 +</code>
 +
 +===== shell script 파라미터 갯수 검사 =====
 +[[http://stackoverflow.com/questions/6482377/check-existence-of-input-argument-in-a-bash-shell-script|Check existence of input argument in a Bash shell script]]
 +<code sh>
 +if [ $# -eq 0 ]
 +  then
 +    echo "No arguments supplied"
 +    exit
 +fi
 +
 +# 혹은 특정 파라미터가 "" empty 인지 검사
 +if [ -z "$1" ]
 +  then
 +    echo "No argument supplied"
 +    exit
 +fi
 </code> </code>
  
줄 150: 줄 182:
   * [[https://www.gitbook.com/book/mug896/shell-script/details|Bash Shell Script]] 한국어   * [[https://www.gitbook.com/book/mug896/shell-script/details|Bash Shell Script]] 한국어
   * [[http://coffeenix.net/doc/shell/introbashscript.htm|Bash Script intro]]   * [[http://coffeenix.net/doc/shell/introbashscript.htm|Bash Script intro]]
 +  * [[https://zwischenzugs.com/2018/01/06/ten-things-i-wish-id-known-about-bash/|Ten Things I Wish I’d Known About bash – zwischenzugs]]
linux/bash.txt · 마지막으로 수정됨: 2024/02/07 08:41 저자 kwon37xi