Yanor.net/
Wiki
Blog
GitHub
Sandbox
開始行:
* クォーテーションの中でクォーテーションを使う [#g6cab703]
** やりたいこと [#oacad000]
vim 'file 1.txt' 'file 2.txt' # (1)
alias v='vim 'file 1.txt' 'file 2.txt'' # (2)
- (1)で '''file 1.txt''' と '''file 2.txt''' という二つの...
- これを、(2)のようにaliasに設定したい
- この場合は"(ダブルクォーテーション)でくくればよいが、...
** 方法 [#t00ffb8f]
*** (1) '(シングルクォーテーション)をいったん終わらせて...
alias v='vim '"'"'file 1.txt'"'"' '"'"'file 2.txt'"'"''
- ''' v='vim ''' の後の ''' 'file 1.txt ''' を ''' '"'"'f...
- 考え方としては最初の'でいったんシングルクォーテーション...
*** (2) '(シングルクォーテーション)をいったん終わらせて...
alias v='vim '\''file 1.txt'\'' '\''file 2.txt'\'''
- すなわち ''' ' ''' を ''' '\'' ''' で置き換える
- 考え方は(1)と同じで、いったんシングルクォーテーションを...
*** (3) Bashの$'...'を使う [#hc859181]
alias v=$'vim \'file 1.txt\' \'file 2.txt\''
- '(シングルクォーテーション)くくる代わりに、''' $'...'...
- ''' $'...' ''' の中の箇所の ''' ' ''' は単純に ''' \' '...
終了行:
* クォーテーションの中でクォーテーションを使う [#g6cab703]
** やりたいこと [#oacad000]
vim 'file 1.txt' 'file 2.txt' # (1)
alias v='vim 'file 1.txt' 'file 2.txt'' # (2)
- (1)で '''file 1.txt''' と '''file 2.txt''' という二つの...
- これを、(2)のようにaliasに設定したい
- この場合は"(ダブルクォーテーション)でくくればよいが、...
** 方法 [#t00ffb8f]
*** (1) '(シングルクォーテーション)をいったん終わらせて...
alias v='vim '"'"'file 1.txt'"'"' '"'"'file 2.txt'"'"''
- ''' v='vim ''' の後の ''' 'file 1.txt ''' を ''' '"'"'f...
- 考え方としては最初の'でいったんシングルクォーテーション...
*** (2) '(シングルクォーテーション)をいったん終わらせて...
alias v='vim '\''file 1.txt'\'' '\''file 2.txt'\'''
- すなわち ''' ' ''' を ''' '\'' ''' で置き換える
- 考え方は(1)と同じで、いったんシングルクォーテーションを...
*** (3) Bashの$'...'を使う [#hc859181]
alias v=$'vim \'file 1.txt\' \'file 2.txt\''
- '(シングルクォーテーション)くくる代わりに、''' $'...'...
- ''' $'...' ''' の中の箇所の ''' ' ''' は単純に ''' \' '...
ページ名: