문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
linux:shell_script [2021/05/21 08:38] kwon37xi |
linux:shell_script [2024/01/19 08:09] (현재) kwon37xi |
||
|---|---|---|---|
| 줄 4: | 줄 4: | ||
| * [[linux: | * [[linux: | ||
| * [[linux: | * [[linux: | ||
| + | |||
| + | ===== 인자 갯수 검사 Argument count ===== | ||
| + | * '' | ||
| + | <code sh> | ||
| + | if [ " | ||
| + | echo " | ||
| + | fi | ||
| + | </ | ||
| ===== pipe 출력 결과를 그대로 실행하기 ===== | ===== pipe 출력 결과를 그대로 실행하기 ===== | ||
| 줄 48: | 줄 56: | ||
| * [[http:// | * [[http:// | ||
| - | ===== 참조 | + | ===== 실패시 fallback 처리 |
| + | * '' | ||
| + | <code sh> | ||
| + | # curl 명령 실패시에 " | ||
| + | TEST_RESULT=$(curl -Ss https:// | ||
| + | </ | ||
| + | |||
| + | ===== 명령의 존재 검사 ===== | ||
| + | * '' | ||
| + | |||
| + | <code sh> | ||
| + | command -v < | ||
| + | |||
| + | if ! command -v < | ||
| + | then | ||
| + | echo "< | ||
| + | exit | ||
| + | fi | ||
| + | </ | ||
| + | * '' | ||
| + | * '' | ||
| + | <code sh> | ||
| + | if hash gdate 2>/ | ||
| + | gdate " | ||
| + | else | ||
| + | date " | ||
| + | fi | ||
| + | </ | ||
| + | * [[https:// | ||
| + | |||
| + | ===== 참조 ===== | ||
| + | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| 줄 57: | 줄 96: | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| - | * [[https://mug896.github.io/bash-shell/index.html|Introduction | + | * [[https://www.baeldung.com/linux/reading-output-into-array|Reading Output of a Command Into an Array in Bash | Baeldung on Linux]] |