May 15, 2006

What are the special characters of Bash?

Filed under: Linux, *NIX, Bash — Administrator @ 9:25 pm
# Comments. (with exception of “#!”).
; Command separator (semicolon).
;; Terminator in a ‘case’ option (double semicolon)
. “dot” command (period). Equivalent to “source;” or “dot” as a componant of a filename or “dot” character match in regular expression.
partial quoting (double quote)
full quoting (single quote)
, comma operator. The comma operator links together a series of arithmetic operations.
\ escape (backslash). A quoting mechanism for single characters.
/ Filename path separator (forward slash).
` command substitution. The `command` construct makes available the output of command for assignment to a variable.
: null command (colon). This is the shell equivalent of a “NOP” (no op, a do-nothing operation).
! reverse (or negate) the sense of a test or exit status (bang).
* wild card (asterisk) or arithmetic operator (denotes multiplication)
? test operator. Within certain expressions, the ? indicates a test for a condition or wild card. The ? character serves as a single-character “wild card” for filename expansion.
$ Variable substitution (contents of a variable) or end-of-line. In a regular expression, a “$” addresses the end of a line of text.
${} Parameter substitution.
$*, $@ positional parameters.
$? exit status variable. The $? variable holds the exit status of a command, a function, or of the script itself.
$$ process ID variable. The $$ variable holds the process ID of the script in which it appears.
() command group.
{} {xxx,yyy,zzz,…}, this is brace expansion & {}, this is block of code (curly brackets).
{} \; pathname. Mostly used in find constructs. This is not a shell builtin.
[ ] Test expression between [ ].
[[ ]] test. Test expression between [[ ]] (shell keyword).
[ ] array element (n the context of an array) or range of characters (As part of a regular expression)
(( )) integer expansion. Expand and evaluate integer expression between (( )).
>
&>
>&
>>
<
redirection.
<< redirection used in a here document.
<<< redirection used in a here string.
<<< redirection used in a here string.
>, < ASCII comparison.
\<, \> word boundary in a regular expression.
| pipe. Passes the output of previous command to the input of the next one, or to the shell.
<| force redirection (even if the noclobber option is set).
|| OR logical operator.
& Run job in background.
&& AND logical operator.
- option, prefix. Option flag for a command or filter. Prefix for an operator. or redirection from/to stdin or stdout (if postfixed) or previous working directory. A cd - command changes to the previous working directory. or Minus. Minus sign in an arithmetic operation.
= Equals. Assignment operator.
+ Plus. Addition arithmetic operator. or Option. Option flag for a command or filter.
% modulo. Modulo (remainder of a division) arithmetic operation.
~ home directory (tilde).
~+ current working directory.
~- previous working directory.
=~ regular expression match.
^ beginning-of-line. In a regular expression, a “^” addresses the beginning of a line of text.

Source: http://www.tldp.org/LDP/abs/html/special-chars.html

Leave a Reply

Proudly powered by wordpress - Theme by neuro