bash: array - Only print or use certain characters of an element.



  • Take into account the main readme for this section. README first.

    An array called planet.

    $ declare -a planet=(earth wind fire)
    

    Only use 3 characters of element 1, starting at position 0.

    $ echo "${planet[1]:0:3}"
    win
    

Log in to reply
 

© Lightnetics 2024