vancewang
vancewang

Reputation: 5390

why char like "$" "\" are not bash shell metacharacter

While reading the Bash Reference Manual I noticed in the Definitions:

metacharacter

A character that, when unquoted, separates words. A metacharacter is a space, tab, newline, or one of the following characters: ‘|’, ‘&’, ‘;’, ‘(’, ‘)’, ‘<’, or ‘>’.

but chars like $, \ and others have all a special meaning. Why aren't they listed as metacharacters?

Upvotes: 0

Views: 84

Answers (1)

axiac
axiac

Reputation: 72226

You posted the answer in the question (as part of the text you quoted from the documentation).

A metacharacter is:

A character that, when unquoted, separates words.

Neither $, nor \ are used to separate words. When not quoted, both of them are kept together with the character(s) that follow(s) them.

$ is the sigil of a variable.
\ is used as escape character.

Upvotes: 2

Related Questions