User Tools

Site Tools


characters-and-expressions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
characters-and-expressions [2019/04/12 17:43]
Miroslav Bernát
characters-and-expressions [2019/04/12 20:37] (current)
Miroslav Bernát
Line 15: Line 15:
 | **{** <​list>​**;​}** | braces, group commands (commands are executed in the current shell)\\ ''​$ { a; b;} & c &''​\\ (commands „a“ a „b“ are executed sequentially in the background, i.e. one by one, command „c“ is executed simultaneously)\\ ''​$ cd backup || { mkdir backup; cd backup;​}''​ | | **{** <​list>​**;​}** | braces, group commands (commands are executed in the current shell)\\ ''​$ { a; b;} & c &''​\\ (commands „a“ a „b“ are executed sequentially in the background, i.e. one by one, command „c“ is executed simultaneously)\\ ''​$ cd backup || { mkdir backup; cd backup;​}''​ |
 | **{**<​string>​**}** | braces, define a string (comma separated strings) to be used in the pattern; a prefix or suffix can be added to each string that becomes part of the expression\\ ''​$ mkdir p{la,​ri,​oi}nt''​\\ (creates directories „plant”,​ „print” and „point”)\\ ''​$ mv text{1,​2,​3,​4,​5}.txt text_0{1,​2,​3,​4,​5}.txt''​\\ ''​$ touch .{a,​b,​c,​d,​e}''​\\ (creates hidden files of the particular names)\\ ''​$ touch {1..100}''​\\ (creates 100 files)\\ ''​$ echo {A..Z} {a..z} {0..9}''​\\ (displays the range of given characters)\\ ''​$ echo {A..Z}{a..z}{0..9}''​\\ (displays three-figure combinations of characters in the particular order) | | **{**<​string>​**}** | braces, define a string (comma separated strings) to be used in the pattern; a prefix or suffix can be added to each string that becomes part of the expression\\ ''​$ mkdir p{la,​ri,​oi}nt''​\\ (creates directories „plant”,​ „print” and „point”)\\ ''​$ mv text{1,​2,​3,​4,​5}.txt text_0{1,​2,​3,​4,​5}.txt''​\\ ''​$ touch .{a,​b,​c,​d,​e}''​\\ (creates hidden files of the particular names)\\ ''​$ touch {1..100}''​\\ (creates 100 files)\\ ''​$ echo {A..Z} {a..z} {0..9}''​\\ (displays the range of given characters)\\ ''​$ echo {A..Z}{a..z}{0..9}''​\\ (displays three-figure combinations of characters in the particular order) |
-| **%%$((%%**<​expression>​**%%))%%** / **$[**<​expression>​**]** | dollar and double ​parenthes ​/ dollar and square brackets, the arithmetic expression inside is evaluated and replaced by its result\\ ''​$ echo "​2*5=$%%((2*5))%%"''​ / ''​echo "​2*5=$[2*5]"''​\\ ''​2*5=10''​\\ ''#​ uid=500; for usr in a b c; do useradd -u $uid -g appadmin -d /home/$usr -m $usr; chage -M -1 $usr; uid=$%%(($uid+1))%%;​ done''​\\ (creates three application accounts whose UID starts with „500” and is growing by „1”) |+| **%%$((%%**<​expression>​**%%))%%** / **$[**<​expression>​**]** | dollar and double ​parentheses ​/ dollar and square brackets, the arithmetic expression inside is evaluated and replaced by its result\\ ''​$ echo "​2*5=$%%((2*5))%%"''​ / ''​echo "​2*5=$[2*5]"''​\\ ''​2*5=10''​\\ ''#​ uid=500; for usr in a b c; do useradd -u $uid -g appadmin -d /home/$usr -m $usr; chage -M -1 $usr; uid=$%%(($uid+1))%%;​ done''​\\ (creates three application accounts whose UID starts with „500” and is growing by „1”) |
 | **`**<​command>​**`** / **$(**<​command>​**)** | backquotes (backticks)/​dollar and parentheses,​ the command inside the backquotes is processed and replaced with its output\\ ''​$ ls -l `which java`''​ / ''​ls -l $(which java)''​\\ (the output of the command „which java” is passed to the command „ls -l”) | | **`**<​command>​**`** / **$(**<​command>​**)** | backquotes (backticks)/​dollar and parentheses,​ the command inside the backquotes is processed and replaced with its output\\ ''​$ ls -l `which java`''​ / ''​ls -l $(which java)''​\\ (the output of the command „which java” is passed to the command „ls -l”) |
 | **PARAMETERS** | **entities in which values ​​are stored** | | **PARAMETERS** | **entities in which values ​​are stored** |
Last modified: 2019/04/12 20:37 by Miroslav Bernát

visits: