User Tools

Site Tools


wiki:2018shell_syntax

Differences

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

Link to this comparison view

wiki:2018shell_syntax [2018/07/16 18:07] (current)
david created
Line 1: Line 1:
 +====== Shell Syntax ======
 +
 +You may have noticed that the language of the shell is hard to understand.
 +
 +Here are some general tips that may help.
 +
 +A command name is usually:
 +  * An abbreviation for a verb
 +  * often excluding vowels
 +  * often 3 characters or fewer
 +
 +Takes the form of an imperative (you are giving a command):
 +  * Do [a thing] to [something] ​
 +  * E.g.: "​delete file"
 +  * Takes the form: [verb] [argument]
 +  * Linux example: "rm file"
 +
 +They went with "​remove"​ => rm, instead of using the word "​delete."​
 +
 +Phrases with verbs can be more complex.
 +  * [Verb] [something] -- "Go home"
 +  * [Verb] [something] using [something else] -- "​[Drive] (to) [Denver] (using) [Winnebago]"​
 +  * [Subject] [Verb] [Object] -- [Venus] [text] [Serena]
 +
 +In the last one, we're telling Venus to text her sister Serena. In English, the verb //text// is in the middle. In other languages (such as Arabic, Irish, Filipino) and linux, the verb comes first. ​
 +
 +In those languages, the phrase is ordered this way:
 +
 +> //text// Venus Serena ​
 +
 +Similarly in BASH, the verb would come first (and be abbreviated),​ followed by subject and object.
 +
 +<code bash>
 +$ txt Venus Serena
 +</​code> ​
 +
 +A real linux example is the command that copies: //cp//. You want to copy one thing (the subject) to something else (the object).
 +
 +<code bash>
 +$ cp original duplicate
 +</​code>​
 +
 +This is taking the linguistic form:
 +
 +> copy subject object
 +
 +This is helpful when you want to interpret commands that take multiple arguments, like when you are copying multiple files to a directory.
 +
 +> copy subject1 subject2 subject3 ... object
 +
 +or in BASH:
 +
 +<code bash>
 +$ cp subject1 subject2 subject3 object
 +</​code>​
 +
 +The command interprets the last argument "​object"​ as being a directory, to which subject1, subject2 and subject3 will be copied.
  
wiki/2018shell_syntax.txt ยท Last modified: 2018/07/16 18:07 by david