LoginSignup
0
1

More than 5 years have passed since last update.

メタ文字の取り扱い

Last updated at Posted at 2017-05-09

/(経緯....bashで使用)/

#はじめに

シェルではいくつかの記号について,特殊な意味を持っているものがある。たとえば,
スペースはファイルの区切りとして利用されている。


「My Document」というファイルを表示したい場合に,

$ cat My Document

としてしまうと,「My」と「Document」の2つのファイルを表示しようとしてしまう。
 これらシェルで予約されている記号(メタ文字)や改行といったエスケープ・シーケンスを使いたい場合は,
文字列をクォーテイション("や')記号でくくったり,メタ文字の前にバックスラッシュ(\)記号を付ける。

前述した例では↓

$ cat "My Document"
$ cat 'My Document'
$ cat My\ Document
のように表記できる。


メタ文字は以下の通のようなものがある。

" $ @ & ' ( ) ^ | [ ] { } ; * ? < > ` \ スペース
改行,タブといったエスケープ・シーケンス

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1