Skip to content

Instantly share code, notes, and snippets.

@ymzkjpx
Created September 23, 2022 00:51
Show Gist options
  • Save ymzkjpx/d0295e1d81fc4f545ae3c2c6b83208bb to your computer and use it in GitHub Desktop.
Save ymzkjpx/d0295e1d81fc4f545ae3c2c6b83208bb to your computer and use it in GitHub Desktop.
ShellScript改行文字テスト
echo '########## 単体テスト #########'
echo '【TEST】'
echo ABC #結果: ABC
echo $EDITOR #結果: vim
echo $AAA #結果: 空行
echo ABC && echo $EDITOR #結果: ABC\nvim
echo '########### 組み合わせテスト ############'
echo '【TEST &&】'
cd ~/ABC && echo '&& suceess'
# 結果: ./anpatest.sh: line 8: cd: /Users/apple/ABC: No such file or directory
echo '【TEST ||】'
cd ~/ABC || echo '|| success'
#結果: ./anpatest.sh: line 11: cd: /Users/apple/ABC: No such file or directory\n|| success
echo '【TEST \】'
cd ~/ABC \
echo '\ success'
#結果: ./anpatest.sh: line 14: cd: /Users/apple/ABC: No such file or directory
echo '【TEST \ &&】'
cd ~/ABC \
&& echo '\ && success'
#結果: ./anpatest.sh: line 18: cd: /Users/apple/ABC: No such file or directory
echo '【TEST \ ||】'
cd ~/ABC \
|| echo '\ || success'
#結果: ./anpatest.sh: line 22: cd: /Users/apple/ABC: No such file or directory\n\ || success
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment