Learning Bash Best Practices - 03 // The problems with bash functions, parsing a CSV, unit testing

Поділитися
Вставка
  • Опубліковано 11 січ 2025

КОМЕНТАРІ •

  • @alexanderelgert6037
    @alexanderelgert6037 2 роки тому +1

    you could use IFS=',' to tokenize the csv line:
    $ echo 'a,b,c' | { declare -a line; IFS=',' read -ra line ; declare -p line; }
    declare -a line=([0]="a" [1]="b" [2]="c")
    additionally the case accepts a leading bracket, which is very practical
    ('h'|'help') ... ;;