Bash Notes
My notes after my bash assignment.
Home | Python | Bash | More Python | Link 4 (TBD) |
Bash Learns
Also in the Checks w/Bash post.
I’ve had basically no experience with Bash before this so it was interesting to learn some of the new functionality now as well. Here is some of what I learned.
Code | Syntax | Notes |
---|---|---|
Variables | key=value | Most variables work the same and it looks like bash works a similar way as well. You don’t put a space in between the key and the value. If you do it looks like bash reads the key as a command and so the variable doesn’t work. Also, to call a variable it looks like you need a $ sign in front, otherwise it just reads it as a string. |
Echo | echo “what you want to print” | Echo is the bash version of print and pretty much works the same, though you can do some cool stuff with periods with it. |
If then | if [[ condition ]] then code else code fi | This again is pretty similar to java or python though there are some differences. For example the condition needs [[]] which is different. Also, you need a then statement to run the code and at the end you need fi to finish the if statement. |