This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
competitive_programming:linux [2018/08/13 16:16] jguerin Added note about bash scripting. |
competitive_programming:linux [2018/08/15 10:48] (current) jguerin Moved Python section down to deemphasize it. |
||
---|---|---|---|
Line 4: | Line 4: | ||
This section assumes a basic working knowledge of Unix development including the use of an command-line editor (e.g., [[https:// | This section assumes a basic working knowledge of Unix development including the use of an command-line editor (e.g., [[https:// | ||
- | ===== Python3 Extras ===== | ||
- | ==== Interactive Interpreter ==== | ||
- | The Python3 interactive interpreter (typically invoked with '' | ||
- | ==== Interactive Interpreter: | + | ===== Pipes and Redirects ===== |
- | <code python> | + | Pipes '' |
- | >>> | + | |
- | >>> for i in range(10): | + | In order to illustrate the use of pipes and redirects, consider |
- | ... print(int(log(2**i, | + | |
- | ... # additional lines in the loop here or <return> to end | + | ===== Command Line Utilities ===== |
- | 1 1 1 1 2 2 2 3 3 3 >>> | + | <code> |
+ | time | ||
</ | </ | ||
- | The above fragment computes powers of two, and then uses the decimal logarithm to compute the number of digits in each power. | + | < |
+ | wc | ||
+ | </ | ||
- | This can be extended to basic nested structures. | + | < |
- | < | + | man |
- | >>> | + | |
- | ... for j in range(3): | + | |
- | ... | + | |
- | ... # single < | + | |
- | 0,0 0,1 0,2 1,0 1,1 1,2 2,0 2,1 2,2 >>> | + | |
</ | </ | ||
- | If you are looking to do anything more complicated, | + | ===== Bash Scripts ===== |
- | ==== Interactive Interpreter: | + | ===== Python3 Command-Line Arguments ===== |
- | The '' | + | |
Consider the Python code: | Consider the Python code: | ||
Line 46: | Line 40: | ||
</ | </ | ||
- | ===== Pipes and Redirects ===== | ||
- | Pipes '' | ||
- | |||
- | In order to illustrate the use of pipes and redirects, consider the following | ||
- | |||
- | ===== Command Line Utilities ===== | ||
- | < | ||
- | time | ||
- | </ | ||
- | |||
- | < | ||
- | wc | ||
- | </ | ||
- | |||
- | < | ||
- | man | ||
- | </ | ||
- | |||
- | ===== Bash Scripts ===== | ||
===== Additional Resources ===== | ===== Additional Resources ===== | ||
Line 79: | Line 54: | ||
/tmp/ | /tmp/ | ||
</ | </ | ||
+ | |||
+ | |||
+ | |||