Skip to content

Conversation

@bobbyiliev
Copy link
Owner

What type of PR is this? (check all applicable)

  • ♻️ Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 👷 Optimization
  • 📝 Documentation Update
  • 🚩 Other

Description

Bug: Substring in Bash :: Slicing - Examples incorrect

Related Tickets & Documents

Fixes #153

Added to documentation?

  • 📜 readme
  • 🙅 no documentation needed
@what-the-diff
Copy link

what-the-diff bot commented Aug 2, 2024

PR Summary

  • Book Updated
    The book version has been updated from Oct 30, 2023 to Feb 8, 2024.

  • Bash Arrays: Examples & Explanations

    • Introduced the correct way to return all elements in the array instead of default arguments.
    • Added guidance on array slicing, indexing, and slicing strings for diverse range of results.
    • Enhanced examples of array element printing, both in regards to individual and range of elements.
    • Emphasized the importance of using [@] when referring to all array elements, alongside the benefits of enclosing parameter expansion in quotes to keep any spaces present within specific array elements.
  • Array Slicing: Expanded Information

    • Broadened scope on array slicing knowledge, detailing functionality in according with Bash 4.0 syntax, individual element accessing, and range of elements.
    • Elucidated how both array indexing and string slicing methods can be utilised to achieve array slicing-esque outcomes.
  • String Slicing: Theory and Practice

    • Expanded theoretical understanding of string slicing in Bash.
    • Revamped examples of extracting string portions using slicing.
    • Clarified the role of the second number in slice notation, explaining it defines the maximum extracted substring length instead of dictating the ending index.
    • Included practical examples of string sections extraction, detailing obtaining the available string characters when the desired count exceeds the string length.
@bobbyiliev bobbyiliev merged commit 5df218a into main Aug 4, 2024
@bobbyiliev bobbyiliev deleted the improve-arrays-chapter branch August 4, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant