"Bash"의 두 판 사이의 차이
63번째 줄: | 63번째 줄: | ||
ANSI color: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors | ANSI color: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors | ||
+ | |||
+ | == 외부입력 == | ||
+ | http://www.gnu.org/software/bash/bash.html | ||
[[분류:Linux]] | [[분류:Linux]] | ||
[[분류:Shortcut]] | [[분류:Shortcut]] |
2020년 12월 25일 (금) 01:42 판
목차
script syntax
if
if [ -z "$1" ] && [ -z "$2" ]
then
somecode1
elif [ "$1" = "run" ]; then
somecode
else
somecode2
fi
연산자
=
!=
-z test that the string is empty (null)
-n test that a string is not null
stdout없애기
>/dev/null
stderr없애기
2>/dev/null
문자열
': 작은 따옴표 안의 문자 그대로 사용
": 문자열 변수는 치환
\": "출력해야 하는 경우
단축키
이동
- alt+b: 현재 단어의 시작으로 이동
- alt+f: 현재 단어의 끝으로 이동
잘라내기
- alt+d: 커서부터 오른쪽 단어 잘라내기
- ctrl+w: 커서의 왼쪽 단어 잘라내기
- ctrl+k: 커서부터 끝까지 잘라내기
- ctrl+u: 처음부터 커서 앞까지 잘라내기
실행
- !!: 직전 명령어 실행
- !tail: 이전 명령어 중에 tail 로 시작했던 명령어 실행
프롬프트
.bashrc에 PS!변수에 저장된다.
special characters: https://www.gnu.org/software/bash/manual/html_node/Controlling-the-Prompt.html#Controlling-the-Prompt
ANSI color: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors