Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- February 24th Notes
- Loops (Can Refer To February 10th Notes)
- number-based for loop (Regular loop) --> Yay
- list-based for loop (For each) --> Ugh
- Number-based For Loop (Refer To myKoolestGameV3.bash)
- ----------------------------------------------------
- for((i=0;i<#;i++));
- do
- // stuff
- done <-- Ends the loop
- value=$(( <-- Double para's mean a pocket of arithmitic
- ^ ^ <-- Dollar sign means that it's going to the value
- | <-- Name
- $ - You can access what's inside the variable (Not like Java)
- Quotes
- ------
- 1.) " <-- Half-quotes: allow expansions. (Allows groupings of characters)
- 2.) ' <-- Full-quotes: literal quote - No expansion (Characters)
- 3.) ` <-- Back-quote/tick: enabling command expansion
- 4.) $( ) <-- Does the same thing as 3 (Unix prefers this method)
- Example: echo "$(ls)" <-- You want the quotes to display what's happening.
- Expansions
- ----------
- 1.) variable expansion
- 2.) algebraic expansion value=$((math))
- 3.) command expansion
- Neat Tricks
- -----------
- ${0} <-- Naming wise, it names it the actual name of the program running it.
- List Base For-each Loop
- -----------------------
- for item in $*; <-- Probably refering to the current directory your in.
- do
- done
- OR
- for entry in a b c d; <-- Runs a b c d, number of times
- do
- done
- OR
- for entry in 'ls';
- do
- // This one is really cool
- done
- Wild Cards
- ----------
- * - 0 or more of anything
- ? - 1 of any single character
- [ ] - Character class (Grouping of characters. Example: ls [t] --> List everything with a t (Lowercase or Uppercase)
- [^ ] - Inverted char class (When grouped with characters, means those characters cannot be that.
- ^ <-- [^aeiou]?? First character cannot be those characters.
- /////////////////////////////////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement