Rob Young | digital

Personal Reference

I find myself searching for the same bits of documentation again and again. This page is a collection of the things I find myself looking up most often.




Nested comprehensions

  for inner in outer
  for item in inner

Special methods

Special method names


Escape single quotes

Since Bash 2.04 some escapes are allowed in $ strings.

> echo $'foo \'bar\' foo'
foo 'bar' foo

Iterate over files with spaces the names

This is usually good enough for my uses. Taken from this amazing StackExchange answer.

find . -type f -name "*.csv" -print0 | while IFS= read -r -d '' file; do
    echo "file = $file"
    diff "$file" "/some/other/path/$file"
    read line </dev/tty

Shellcheck warning pages

These pages give the full help pages for each shellcheck lint, including the correct code to use.