diff --git a/pages/common/[.md b/pages/common/[.md index 7d28fcf9af4525..58ed76292763a7 100644 --- a/pages/common/[.md +++ b/pages/common/[.md @@ -5,9 +5,13 @@ > See also: `test`. > More information: . -- Test if a given variable is equal/not equal to the specified string: +- Test if a given variable is equal to the specified string: -`[ "${{variable}}" {{=|!=}} "{{string}}" ]` +`[ "${{variable}}" = "{{string}}" ]` + +- Test if a given variable is not equal to the specified string: + +`[ "${{variable}}" != "{{string}}" ]` - Test if a given variable is [eq]ual/[n]ot [e]qual/[g]reater [t]han/[l]ess [t]han/[g]reater than or [e]qual/[l]ess than or [e]qual to the specified number: diff --git a/pages/common/[[.md b/pages/common/[[.md index a56a3928267a99..e54f08c044909a 100644 --- a/pages/common/[[.md +++ b/pages/common/[[.md @@ -4,13 +4,13 @@ > Returns a status of 0 if the condition evaluates to true, 1 if it evaluates to false. > More information: . -- Test if a given variable is equal/not equal to the specified string: +- Test if a given variable is equal to the specified string or glob: -`[[ ${{variable}} {{==|!=}} "{{string}}" ]]` +`[[ ${{variable}} == "{{string}}" ]]` -- Test if a given string conforms the specified glob/`regex`: +- Test if a given string conforms the specified `regex`: -`[[ ${{variable}} {{==|=~}} {{pattern}} ]]` +`[[ ${{variable}} =~ {{pattern}} ]]` - Test if a given variable is [eq]ual/[n]ot [e]qual/[g]reater [t]han/[l]ess [t]han/[g]reater than or [e]qual/[l]ess than or [e]qual to the specified number: diff --git a/pages/common/bg.md b/pages/common/bg.md index dc6c2ea65ce7f7..2ca8deef6acef7 100644 --- a/pages/common/bg.md +++ b/pages/common/bg.md @@ -1,6 +1,6 @@ # bg -> Resume suspended jobs (e.g. using ``), and keeps them running in the background. +> Resume suspended jobs (e.g. using ``), and keep them running in the background. > See also: `jobs`, `fg`, `disown`. > More information: . diff --git a/pages/common/command.md b/pages/common/command.md index 1997138fdd4cf9..71af52e5b2acdd 100644 --- a/pages/common/command.md +++ b/pages/common/command.md @@ -1,6 +1,6 @@ # command -> Command forces the shell to execute the program and ignore any functions, builtins and aliases with the same name. +> Force the shell to execute the program and ignore any functions, builtins, and aliases with the same name. > More information: . - Execute the `ls` program literally, even if an `ls` alias exists: diff --git a/pages/common/continue.md b/pages/common/continue.md index 46faca8baa444f..c22facf98fd192 100644 --- a/pages/common/continue.md +++ b/pages/common/continue.md @@ -1,6 +1,6 @@ # continue -> Skip to the next iteration of a `for`, `while`, `until` or `select` loop. +> Skip to the next iteration of a `for`, `while`, `until`, or `select` loop. > More information: . - Skip to the next iteration: diff --git a/pages/common/enable.md b/pages/common/enable.md index da89578ad29643..1a7ae432372d35 100644 --- a/pages/common/enable.md +++ b/pages/common/enable.md @@ -10,3 +10,7 @@ - Disable a builtin (works in Bash only): `enable -n {{command}}` + +- Re-enable a builtin: + +`enable {{command}}` diff --git a/pages/common/false.md b/pages/common/false.md index 9b28001c7496ef..24634c525a0e0d 100644 --- a/pages/common/false.md +++ b/pages/common/false.md @@ -1,8 +1,13 @@ # false > Returns a non-zero exit code. -> More information: . +> See also: `true`. +> More information: . - Return a non-zero exit code: `false` + +- Make a command always exit with 1: + +`{{command}} && false` diff --git a/pages/common/fc.md b/pages/common/fc.md index 176345d3df6ace..c572e5a581b582 100644 --- a/pages/common/fc.md +++ b/pages/common/fc.md @@ -1,6 +1,7 @@ # fc -> Open the most recent command for editing and then run it. +> Open the recent commands for editing and then run them. +> See also: `history`. > More information: . - Open the last command in the default system editor and run it after editing: diff --git a/pages/common/fg.md b/pages/common/fg.md index ab586c75892e99..67104e36b9a637 100644 --- a/pages/common/fg.md +++ b/pages/common/fg.md @@ -1,7 +1,7 @@ # fg > Run jobs in foreground. -> See also: `jobs`, `bg`, `disown`. +> See also: `jobs`, `bg`, `disown`, `%`. > More information: . - Bring most recently suspended or running background job to foreground: diff --git a/pages/common/for.md b/pages/common/for.md index 7dec2192468fad..961bb9f0557819 100644 --- a/pages/common/for.md +++ b/pages/common/for.md @@ -3,7 +3,7 @@ > Perform a command several times. > More information: . -- Iterate through command line arguments: +- Iterate through command line parameters: `for {{variable}}; do {{echo $variable}}; done` diff --git a/pages/common/getopts.md b/pages/common/getopts.md index fc055c0e3f7fec..4902336981395a 100644 --- a/pages/common/getopts.md +++ b/pages/common/getopts.md @@ -1,7 +1,7 @@ # getopts > Parse shell options from arguments. -> This command does not support longform options and thus using `getopt` is recommended instead. +> Note: This command does not support longform options and thus using `getopt` is recommended instead. > More information: . - Check if an option is the first set option in the current context: diff --git a/pages/common/help.md b/pages/common/help.md index a4fc489c3055d7..4cd525df612971 100644 --- a/pages/common/help.md +++ b/pages/common/help.md @@ -17,11 +17,11 @@ - Print instructions on how to use `[[ ]]` for conditional commands: -`help [[ ]]` +`help [[` - Print instruction on how to use `(( ))` to evaluate arithmetic expressions: -`help \( \)` +`help \(` - Print instructions on how to use the `cd` command: diff --git a/pages/common/let.md b/pages/common/let.md index 7a64ca98fd2c04..8379910432e8a7 100644 --- a/pages/common/let.md +++ b/pages/common/let.md @@ -1,7 +1,6 @@ # let > Evaluate arithmetic expressions in shell. -> Supports variables, operators, and conditional expressions. > More information: . - Evaluate a simple arithmetic expression: diff --git a/pages/common/return.md b/pages/common/return.md index 3352f7e9c1f1d9..65f5b92d6bc3e9 100644 --- a/pages/common/return.md +++ b/pages/common/return.md @@ -1,6 +1,8 @@ # return -> Exit a function or a script if run with `source`. +> Exit a function. +> Can exit out of a script if run with `source`. +> See also: `exit`. > More information: . - Exit a function prematurely: diff --git a/pages/common/shopt.md b/pages/common/shopt.md index eee8136e2d4743..1a4e102cde8f9e 100644 --- a/pages/common/shopt.md +++ b/pages/common/shopt.md @@ -4,7 +4,7 @@ > Generic POSIX shell variables (stored in `$SHELLOPTS`) are managed with the `set` command instead. > More information: . -- List of all settable options and whether they are set: +- List of all setable options and whether they are set: `shopt` diff --git a/pages/common/time.md b/pages/common/time.md index 041ba39acdac55..1c47b64815c0cc 100644 --- a/pages/common/time.md +++ b/pages/common/time.md @@ -1,7 +1,7 @@ # time > Measure how long a command took to run. -> Note: `time` can either exist as a shell builtin, a standalone program or both. +> Note: `time` can either exist as a shell builtin, a standalone program, or both. > See also: `times`. > More information: . diff --git a/pages/common/times.md b/pages/common/times.md index 93447c165a8d70..b065a95290a854 100644 --- a/pages/common/times.md +++ b/pages/common/times.md @@ -1,9 +1,10 @@ # times > Print the cumulative CPU usage time of the current shell. +> First line is current shell CPU usage for User and System. Second is all child processes. > See also: `time`. > More information: . -- Print CPU usage. First line is current shell CPU usage for User and System. Second is all child processes: +- Print CPU usage: `times` diff --git a/pages/common/true.md b/pages/common/true.md index ad60383248c2f9..6cb884fa26cda2 100644 --- a/pages/common/true.md +++ b/pages/common/true.md @@ -1,9 +1,13 @@ # true > Returns a successful exit status code of 0. -> Use this with the || operator to make a command always exit with 0. -> More information: . +> See also: `false`. +> More information: . - Return a successful exit code: `true` + +- Make a command always exit with 0: + +`{{command}} || true` diff --git a/pages/common/ulimit.md b/pages/common/ulimit.md index bc72abf502cbf4..ec9d57c89731ca 100644 --- a/pages/common/ulimit.md +++ b/pages/common/ulimit.md @@ -1,7 +1,7 @@ # ulimit > Get and set resource limits for user processes. -> It is a shell builtin hence not shell-agnostic. +> This is a shell builtin hence not shell-agnostic. > More information: . - Get the properties of all the user limits: diff --git a/pages/common/unset.md b/pages/common/unset.md index 6db05bc8a7de6a..e5e04436ceab11 100644 --- a/pages/common/unset.md +++ b/pages/common/unset.md @@ -3,14 +3,14 @@ > Remove shell variables or functions. > More information: . -- Remove the variable `foo`, or if the variable doesn't exist, remove the function `foo`: +- Remove variable, or if the variable doesn't exist, remove the function of the same name: -`unset {{foo}}` +`unset {{variable}}` -- Remove the variables foo and bar: +- Remove variables: -`unset -v {{foo}} {{bar}}` +`unset -v {{variable1 variable2 ...}}` -- Remove the function my_func: +- Remove the function: -`unset -f {{my_func}}` +`unset -f {{function_name1 function_name2}}` diff --git a/pages/linux/jobs.md b/pages/linux/jobs.md index 2c1c65c3bf474a..3e6f7a0fdf8408 100644 --- a/pages/linux/jobs.md +++ b/pages/linux/jobs.md @@ -2,6 +2,7 @@ > Shell builtin for viewing information about processes spawned by the current shell. > Options other than `-l` and `-p` are exclusive to Bash. +> See also: `fg`, `bg`, `disown`, `%`. > More information: . - View jobs spawned by the current shell: