#TIL 윈도우 터미널(windows terminal)에서 git bash 사용하기
마이크로소프트에서 만든 윈도우 터미널(windows terminal)은 셸(shell)을 호스팅하는 애플리케이션(application)이다. 즉 이 애플리케이션을 사용해 cmd, bash, powershell 등을 띄울 수 있다. 화면 분할도 지원해서 그동안 사용하던 ConEmu를...
마이크로소프트에서 만든 윈도우 터미널(windows terminal)은 셸(shell)을 호스팅하는 애플리케이션(application)이다. 즉 이 애플리케이션을 사용해 cmd, bash, powershell 등을 띄울 수 있다. 화면 분할도 지원해서 그동안 사용하던 ConEmu를...
bash에서 고정 인자와 가변 인자가 섞여 있다면 어떻게 처리해야 할까?
$ ls | sort --version-sort --reverse | grep -Po [0-9]+\\.[0-9]+\\.[0-9]+ | head -n 1
$ find . -type f ! -name '*.txt' -delete
$ filename=20190131064326_abcdefghijk.exs $ echo `expr match "$filename" '\([0-9]*\)'` 20190131064326
문자열 부분 삭제로 원하는 정보를 간단하게 추출할 수 있다.
$ find . -type f -print0 -name '*.sh' | xargs -0 dos2unix dos2unix: converting file ./hello world.sh to Unix format... dos2unix: converting file ./sub_test/h...
cat << EOF > /tmp/yourfilehere These contents will be written to the file. This line is indented. EOF
$ command -v emacs /usr/local/bin/emacs $ echo $? 0 $ command -v vim $ echo $? 1
$ echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc
$ docker run \ --name gerrit-mysql \ --volumes-from=gerrit-data \ -e MYSQL_ROOT_PASSWORD=123456 \ -e MYSQL_DATABASE=reviewdb \ -e MYSQL_USER=gerrit2 \ -e MYS...
배포에 SVN을 사용한다. 단순히 복사해서 커밋한다면 삭제한 파일 반영이 안 된다. 삭제된 파일을 반영해야 한다.
$ echo a/b/c/d | cut -d/ -f 2 b $ echo a/b/c/d | cut -d/ -f -2 a/b $ echo a/b/c/d | cut -d/ -f 2- b/c/d
$ for file in *.jpeg; do mv "$file" "$(basename "$file" .jpeg).jpg"; done
${parameter:-word}
```bash #!/usr/bin/env bash
cd "$(dirname "$0")/.."
>result.txt echo first line >>result.txt echo second line >>result.txt echo third line
$ MD="~/My Documents" $ echo "${MD}" ~/My Documents $ cd "${MD}" bash: cd: ~/My Documents: No such file or directory
$ cd My\ Documents $ pwd /c/Users/ohyecloudy/My Documents
제어 연산자(control operator)를 사용하면 한 줄에 여러 명령을 실행할 수 있다. 간단히 if 문(statement)을 쓴 효과를 누릴 수 있다.
Update <2025-03-22 Sat> Git 2.37에 추가됐다 git config --global push.autoSetupRemote true 설정 후 git push 를 하면 리모트 브랜치를 자동으로 설정해준다.
ohyecloudy@air5 ~/project/ddiary (master) $
$ find / -name 'to_be_searched.file'
#!/bin/sh ... export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH" exec node_modules/.bin/hubot --name “hubot" "$@"
batch script
Vagrant.configure(2) do |config| $script = <<-SHELL ... source ~/.profile if [ -z "$JAVA_HOME" ]; then export JAVA_HOME=/usr/lib/jv...
출력 자체를 막을 순 없고 null 디바이스에 리다이렉션(redirection)해서 출력을 감춘다.