Commit Graph

98 Commits

Author SHA1 Message Date
Rico Sta. Cruz 511de900ba
Formatting updates (#2133)
- Update some sheets which have very long sections
- Remove `layout: 2017/sheet` (everything has the same layout now)
- Remove outdated sheets
2024-04-03 18:30:24 +11:00
Tamas Papp dc066dc18f
Remove redundant syntax (#2111)
Either use the `function` or `()` but not both, it's redundant.
2024-03-16 00:26:36 +11:00
Rico Sta. Cruz 3e4487a8ed
Fix formatting of /bash 2024-03-16 00:21:53 +11:00
Mateus Caruccio 7317522a8c
Adds Indirection and prefix name expansion (#2102) 2024-02-15 07:40:36 +11:00
Iftakhar Husan de4bb16b2d
Add multi range brace expansion to bash.md (#2071) 2023-12-14 08:54:12 +11:00
Brian Schonecker ca529c9d4f
Minor update to the Variables section to BASH cheat sheet. (#2016) 2023-06-23 20:57:11 +10:00
Habetdin 62e5f5f5ea
bash: Recover broken links using Web Archive (#2004) 2023-06-02 20:01:51 +10:00
Dan Nissenbaum b91885ec71
Alternative form of long prefix/suffix removal (#1941)
The ${foo/%from} is an alternative form of the long suffix removal.
Likewise, he ${foo/#from} is an alternative form of the long prefix removal.

Test cases:

~~~bash
foo=gododa

# The following are the same: Long prefix removal.
# Result: r=a
r=${foo/#g*d}
r=${foo##g*d}
# (Compare to short prefix removal)
# Result: r=oda
r=${foo#g*d}

foo=agogod

# The following are the same: Long suffix removal.
# Result: r=a
r=${foo/%g*d}
r=${foo%%g*d}
# (Compare to short suffix removal)
# Result: r=ago
r=${foo%g*d}
~~~
2023-01-31 19:55:15 +11:00
Sonia Hamilton 83017d313e
Update bash.md (#1917)
* Update bash.md

declare variable as integer, then increment

* Update bash.md

Co-authored-by: Rico Sta. Cruz <rstacruz@users.noreply.github.com>
2022-12-16 08:05:23 +11:00
tripleee 271e0b7c5d
bash.md: update with best practices (#1897) 2022-10-30 22:55:55 +11:00
Nicolas Zagulajew e02473bcb5
add ${PIPESTATUS[c]} special var (#1800)
Co-authored-by: Rico Sta. Cruz <rstacruz@users.noreply.github.com>
2022-07-07 23:09:23 +10:00
tew 05b5e05d09
Added link to Introduction section (#1854)
Added Bash Hackers Wiki link to the Introduction section, as this is just as useful as the other two.
2022-07-07 22:57:06 +10:00
verbatino 5a23b79e78
Add tr command to bash cheatsheet (#1802)
Co-authored-by: Rico Sta. Cruz <rstacruz@users.noreply.github.com>
2022-03-13 22:08:22 +11:00
Sami Harju f5125bd1ec
Update bash.md (#1760) 2021-12-22 16:21:16 +11:00
Peter C. S. Scholtens c1741f6923
Update bash.md (#1757) 2021-12-15 09:36:19 +11:00
Christopher Hopper b28b6527f3
Add special parameter $_ to bash cheatsheet (#1736) 2021-11-03 22:06:31 +11:00
Dawit f6faef05d8
Fix a couple of typos (#1720) 2021-10-21 14:30:57 +11:00
Matilde Bravo 8646bb2c89
Updated description for arguments section (#1620) 2021-02-18 17:56:44 +11:00
DJCrashdummy 8747708136
bash: Correct mistakes at $RANDOM (#1147)
- using `=` just throws an error!
- `200` limits the result to 200 possible numbers starting with 0! so the maximum is 199.
- added `$` straight before `RANDOM` to be on the safe side.
2020-08-03 22:31:11 +10:00
Rico Sta. Cruz c792f1b418
Add introduction sections (#1497) 2020-07-06 00:38:31 +10:00
Rico Sta. Cruz 6b43bf97da Cleanup: update timestamps 2020-07-05 21:11:36 +10:00
hyww a54b580e01
bash: Fix substring expansion with negative offset (#947)
Co-authored-by: Rico Sta. Cruz <rstacruz@users.noreply.github.com>
2020-07-05 21:04:28 +10:00
Rico Sta. Cruz 360bb87287 Cleanup: update timestamps of files 2020-07-04 23:33:09 +10:00
Rico Sta. Cruz d4e3421ac6 Format: update some table formatting 2020-07-04 23:29:16 +10:00
Zeebrommer 87ed01b739
Bash: add `else` example (#1484)
I always forget if `else` is to be followed by a `;` or not. Add it to the conditionals chapter where I would expect it.
2020-07-03 00:45:04 +10:00
Petr Heinz 3a918a1619
bash: expanded working with arrays (#534) 2020-06-24 00:23:07 +10:00
Rico Sta. Cruz 214a4ed82e
Merge pull request #1462 from kozhemyak/patch/add-bash-lastindex
Add a way to get the last element
2020-06-17 23:22:27 +10:00
Rico Sta. Cruz ae18baa7e9
Merge pull request #1383 from zhumengu/master 2020-06-14 23:55:27 +10:00
Rico Sta. Cruz d5683a9ddf
Update bash.md 2020-06-14 23:54:47 +10:00
Rico Sta. Cruz 242c5bccbf
Merge pull request #1397 from rajinder-yadav/patch-1 2020-06-13 10:16:20 +10:00
Rico Sta. Cruz d0381c2254
Update bash.md 2020-06-13 10:16:14 +10:00
Rico Sta. Cruz a78a39538b
Merge pull request #1402 from TaylorPzreal/patch-1 2020-06-13 10:15:22 +10:00
Rico Sta. Cruz aa8c2632d7
Update bash.md 2020-06-13 10:15:03 +10:00
Rico Sta. Cruz bf22b55008
Update bash.md 2020-06-13 10:11:51 +10:00
Nikolay Kozhemyak cd02419737 Add a way to get the last element 2020-06-12 21:10:54 +06:00
Angus Hollands 0361fa173b
Update bash.md 2020-04-20 11:21:31 +01:00
Angus Hollands 7a2322761a Fix nullity checks for parameter expansion 2020-04-20 10:19:52 +00:00
TaylorPzreal 42df935e43
Update bash.md
Substring from the right should include __parentheses__
2020-04-07 08:45:15 +08:00
Rajinder Yadav 3d839093e9
Correct conditions, removed superfluous brackets 2020-04-01 07:44:50 -04:00
zhumengu ef9f00aa5c parent directory example 2020-03-14 15:08:20 +08:00
Alexander Berezovsky d0da7addd5
Add bash $_ last argument of the previous command 2020-02-20 12:11:57 -08:00
Matthew Pfeiffer 0b8a65c575 bash: fix line reading example
`< file.txt | cmd` only works in zsh, not bash (as of bash 5.0.11).
2020-01-24 21:07:10 -05:00
Rico Sta. Cruz 2906fc9c6e
Merge pull request #1238 from btandersen383/patch-1
Fix if regex match
2020-01-01 10:05:33 +11:00
Behnam Esfahbod ❄ f7a365b23d
Update bash.md
Use `shopt -s` for setting Bash-specific options.
2019-11-30 14:07:21 -08:00
Rico Sta. Cruz 7813be2238 bash: Move examples to the bottom 2019-11-17 17:15:12 +11:00
Beathan Andersen c5006cfd4f
fix if regex match
The regex string should not have any quotes around it. To validate test:
$ if [[ "A" =~ . ]]; then echo pass; else echo fail; fi
with and without quotes
2019-10-16 13:52:50 -05:00
Rico Sta. Cruz 7bc7228728
Fix extra fences 2019-10-15 20:30:00 +11:00
Michael King f1a7af534f update metadata 2019-10-04 17:26:14 -04:00
Michael King 8843c62e6d add the $0 special variable to bash.md 2019-10-02 11:27:23 -04:00
Nicholas Chen 0655d01d62
Updating printf functions
Updating printf functions to print numbers and floats.
2019-09-18 21:41:04 -04:00