Hacker News new | ask | show | jobs
by iClaudiusX 2706 days ago
A few things I would add:

brace expansions

  combine for combinations

    {a..c}{1..3}  # a1 a2 a3 b1 b2 b3 c1 c2 c3

  step size

    {0..10..2}  # 0 2 4 6 8 10
mapfile to read lines from file to array

  mapfile -t arrayname < filename

    -t     # remove trailing newline for each element

    -u FD  # read from file descriptor FD

    -s N   # skip first N lines

    -n N   # read at most N lines

    -O N   # start populating array at index N
array quoting

  "${array[@]}"  # expand all elements, individually quoted

  "${array[*]}"  # expand all elements, group quoted
translate number from base to decimal for base in (2,64)

  $(( base#num ))