-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concept: variables #700
Concept: variables #700
Conversation
Bash has two kinds of data: strings and arrays. | ||
We'll talk about arrays later. | ||
|
||
You assign a variable like this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You assign a variable like this | |
You assign a variable (often shortened to var) like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it often shortened to var? That's news to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I mean, your next line is varname
and not variablename
;) Or you can avoid shortening it in the example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved this by using name="value"
for the example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For teaching material, regardless, I do prefer using full names, even if it is often shortened in practice. Those that are not "acronyms and abbreviations as a first language" can then easily look up those words in an English dictionary, making interpretation and deciphering easier (especially on top of mult-language audience/readers being highly likely on this platform).
concepts/variables/introduction.md
Outdated
Variables can also be called "parameters". | ||
The difference is that a variable is assigned by you, the programmer. | ||
A parameter can be a read-only variable that is set by the shell. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variables can also be called "parameters". | |
The difference is that a variable is assigned by you, the programmer. | |
A parameter can be a read-only variable that is set by the shell. | |
Many variables are assigned by you, the programmer. | |
Some variables are set automatically by the shell. | |
These are called parameters. |
As far as I know, bash doesn't many any of those read only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just this, ignoring any subtle differences?
Variables can also be called "parameters".
The two terms will be used interchangably in this document.
|
||
## Command Substitution | ||
|
||
A very frequent operation you will do in bash scripts is to capture the output of a command and store it in a variable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doc mentions "you" a whole lot and things "you will do". I think the prior doc was a little bit less ...directed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I did lift most of the text from greycat for the last one. Maybe we can "put a pin in it" and revisit it after a few docs are written.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could modify the factoid messages and/or Wooledge wiki, if that helps :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon reflection, I'll circle back to the first concept to give it a rewrite in my voice.
Bash has two kinds of data: strings and arrays. | ||
We'll talk about arrays later. | ||
|
||
You assign a variable like this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I mean, your next line is varname
and not variablename
;) Or you can avoid shortening it in the example.
|
||
## Command Substitution | ||
|
||
A very frequent operation you will do in bash scripts is to capture the output of a command and store it in a variable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could modify the factoid messages and/or Wooledge wiki, if that helps :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Knowing that some rewrite to different voice is pending...
@@ -1,10 +1,10 @@ | |||
[ | |||
{ | |||
"description": "Commands and Arguments in the Bash Guide", | |||
"description": "\"Commands and Arguments\" in the BashGuide", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In prose should "Bash Guide" be two words? That is why in code we would CamelCase them, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's literally a WikiWord, but that's not no common anymore.
Bash has two kinds of data: strings and arrays. | ||
We'll talk about arrays later. | ||
|
||
You assign a variable like this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For teaching material, regardless, I do prefer using full names, even if it is often shortened in practice. Those that are not "acronyms and abbreviations as a first language" can then easily look up those words in an English dictionary, making interpretation and deciphering easier (especially on top of mult-language audience/readers being highly likely on this platform).
Next concept: variables
This one is much more terse. I may have swung the pendulum too far.