Timetombs

泛义的工具是文明的基础,而确指的工具却是愚人的器物

66h / 118a
,更新于 2024-11-10T12:35:25Z+08:00 by   330589a

[Bash] Syntax

版权声明 - CC BY-NC-SA 4.0

1 Command Option Parameter

# 查看版本
bash --version

# show the current shell.
echo $SHELL

# displays all installed shell.
cat -n /etc/shells
  1. command : cat
  2. option : -n
  3. parameter : /etc/shells

1.1 Command

  1. Pipeline
  2. Looping
  3. Conditional
  4. Grouping

1.2 Parameter

CharacterMeaning
$0
$1
$@subshell
$#subshell
$?exit status of the most recently executed foreground pipeline
$-
$$
$!

2 Special Characters

CharacterMeaning
#Comment
`Command substitution (archaic)
$Variable expression
(Start subshell
)End subshell
\Quote next character
&Background job
{Start command block
}End command block
;Shell command separator
'Strong quote
"Weak quote
!Pipeline logical NOT

2.1 Wildcard Character

CharacterMeaning
*String wildcard
?Single-character wildcard
[Start character-set wildcard
]End character-set wildcard

2.2 Path Character

CharacterMeaning
/Root directory
/Pathname directory separator
~Home directory

2.3 I/O Character

CharacterMeaning
|Pipe
<Input redirect
>Output redirect
>>Append redirect (if file exists)
2>Error output redirect
2>&1Send error to output redirect
下一篇 : [Bash] Expansion