User Tools

Site Tools


2018cmd_list

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
2018cmd_list [2018/09/04 14:54]
david [Environmental Variables / Files]
2018cmd_list [2018/09/07 10:33] (current)
david [Syntax]
Line 1: Line 1:
 ~~NOTOC~~ ~~NOTOC~~
  
-====== A running list BASH command, syntax, and environmental variables ======+====== A running list of BASH commands, syntax, and environmental variables ====== 
 +This page will be updated with new concepts for each lecture. 
  
 ===== Commands ===== ===== Commands =====
Line 7: Line 9:
 ^   ​Command/​Program ​ ^  Description ​                ​^ ​        ​example/​syntax ​      ^ ^   ​Command/​Program ​ ^  Description ​                ​^ ​        ​example/​syntax ​      ^
 ^  9/4/18 - Scripting, executable permissions/​conventions. ​                      ||| ^  9/4/18 - Scripting, executable permissions/​conventions. ​                      |||
-| chmod   | Change the mode of a file or directory ​ | ''​chmod ​755 filename'' ​      |+| chmod   | Change the mode of a file or directory ​ | ''​chmod ​MODE FILE'' ​      
 +|         ​| ​                                        | ''​chmod OCTAL-MODE FILE'' ​|
 | echo    | "​echo"​ values to the screen ​            | ''​echo "​string $varname"'' ​  | | echo    | "​echo"​ values to the screen ​            | ''​echo "​string $varname"'' ​  |
-| nano    | Edit a file                             | ''​nano ​filename'' ​           |+| nano    | Edit a file                             | ''​nano ​FILE'' ​           |
 | rev     | **rev**erse input stream ​               | ''​echo "​abcd"​ | rev'' ​       | | rev     | **rev**erse input stream ​               | ''​echo "​abcd"​ | rev'' ​       |
-| touch   | Update file modification time. Create file if necessary | ''​touch ​filename''​ |+| touch   | Update file modification time. Create file if necessary | ''​touch ​FILE''​ |
 | tr      | **Tr**anslate or delete characters ​     | ''​tr [SET1] [SET2]'' ​        | | tr      | **Tr**anslate or delete characters ​     | ''​tr [SET1] [SET2]'' ​        |
 | which   | Location of an executable in your PATH  | ''​which ls'' ​                ​| ​ | which   | Location of an executable in your PATH  | ''​which ls'' ​                ​| ​
Line 31: Line 34:
  
  
 +===== Syntax =====
 +
 +
 +^ Keyword(s)/​Operators ​     ^ Description ​ ^ Example ^
 +^  9/4/18 - Scripting, executable permissions/​conventions. ​                                  |||
 +| ''​[ ]'' ​                  | conditional ​ | ''​[ -z ""​ ]'' ​ |
 +| ''​if,​then,​else,​fi'' ​      | flow control | ''​if [ -z ""​ ]; then echo '​empty!';​ else echo 'NOT empty!';​ fi''​ |
 +| ''​test'' ​                 | flow control | ''​test -z ""''​ |
 +| ''&&​ ||'' ​                | boolean operators for flow control | ''​[ -z ""​ ] && echo '​empty!'​ || echo 'NOT empty!'''​ | 
 +^  9/​6/​18 ​                                                                       |||
 +| ''​let'' ​                  | arithmetic assignment ​ | ''​a=1;​ let a=a+1;''​ |
 +| ''​$<​nowiki>​((expr))</​nowiki>'' ​            | arithmetic expressions | ''​echo <​nowiki>​$((a+1))</​nowiki>'' ​ |     
 +| ''​while'' ​                | loop           | ''<​nowiki>​a=0;​ while [ $a -lt 10 ]; do echo $a; let a=a+1; done</​nowiki>''​ | 
 +| ''​for var in list'' ​      | loop           | ''<​nowiki>​for num in 1 2 3; do echo $num; done</​nowiki>''​ |
 +^  9/​11/​18 ​                                                                      |||
2018cmd_list.1536094475.txt.gz · Last modified: 2018/09/04 14:54 by david