Work in progress: 181,232 of 181,233 sites checked so far, more every week · updated 2 Nov 2026Missing a blog? Tell us

Top all-time · #3660

D

David Pashley

Personal blog · davidpashley.comprogrammingsecurity

David Pashley's personal blog at davidpashley.com covers programming and security. Since 2010, 20 different Hacker News readers have linked it 22 times, most often “Writing Robust Bash Shell Scripts”. The last post was in 2016, but the archive is still widely read.

Visit the blog
22mentions?
20HN people?
2010–2024first – last linked?
Links on Hacker News per year · peak 3 in 2010

Too few sampled comments (12) to say how often HN recommends it.?

Why HN links it

HN readers link David Pashley's articles on writing robust shell scripts, covering set -e, set -u and safe bash practices, along with a post on disabling DNS prefetching. Commenters cite them in bash discussions.

Summarised by Claude from a sample of 12 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.

Most-linked posts?

  1. Writing Robust Bash Shell Scripts
    8 people · 8 mentions · first linked 2013-08-14
  2. Writing Robust Bash Shell Scripts
    5 people · 7 mentions · first linked 2018-12-27
  3. Writing Robust Bash Shell Scripts
    4 people · 4 mentions · first linked 2010-04-17
  4. /blog/computing/livejournal-mozilla-bug.html
    2 people · 2 mentions · first linked 2010-01-11

What Hacker News says?

  1. See also: * safe ways to do things in bash: https://github.com/anordal/shellharden/blob/master/how_to_do... * better scripting: https://robertmuth.blogspot.in/2012/08/better-bash-scripting... * robust scripting: https://www.davidpashley.com/articles/writing-robust-shell-s...

    Comment linking /articles/writing-robust-shell-scripts/

    on “Shell script best practices, from a decade of scripting things”
  2. Submitted Writing Robust Bash Shell Scripts as a story · 57 points

    HN discussion
  3. I learnt the same trick some years ago, from an article called Shell Scripts Matter : https://dev.to/thiht/shell-scripts-matter So I took some of the advice and tips offered in there, and wrote a template file to be used as a baseline when writing scripts for any project that might need one: https://github.com/j1elo/shell-snippets/blob/master/template... Other resources that I link in the readme of that repo, becaus…

    Comment linking /articles/writing-robust-shell-scripts/

    on “Help Message for Shell Scripts”
  4. Submitted Writing Robust Bash Shell Scripts as a story · 51 points

    HN discussion
  5. There are problems with the manipulation of binary data in bash, as discussed here: https://unix.stackexchange.com/questions/278639/how-can-i-wo... In particular, the value 0 can't be stored in a bash variable, which almost completely rules out the possibility of byte-by-byte processing of general binary data. It's probably possible with absurd hacks. Quite apart from that, error handling in bash is an awkward chore…

    Comment linking /articles/writing-robust-shell-scripts/

    on “lsix: ls for images”
  6. Submitted Bad Password Policies as a story · 29 points

    HN discussion
  7. See also: Why doesn't set -e (or set -o errexit, or trap ERR) do what I expected? https://mywiki.wooledge.org/BashFAQ/105 What are the advantages and disadvantages of using set -u (or set -o nounset)? https://mywiki.wooledge.org/BashFAQ/112 Safe ways to do things in bash https://github.com/anordal/shellharden/blob/master/how_to_do... Better Bash Scripting in 15 Minutes https://robertmuth.blogspot.com/2012/08/better-…

    Comment linking /articles/writing-robust-shell-scripts/

    on “Bash Debugging”
  8. Submitted Writing robust shell scripts as a story · 5 points

    HN discussion
  9. arnehormann · 2013-08-14Recommends
    Huh, no mention of "set -e -u"? Do yourself a favor and follow this, too: http://www.davidpashley.com/articles/writing-robust-shell-sc...

    Comment linking /articles/writing-robust-shell-scripts/

    on “What I learned from others' shell scripts”
  10. Submitted Writing Robust Bash Shell Scripts as a story · 4 points

    HN discussion
  11. the livejournal change: http://www.davidpashley.com/blog/computing/livejournal-mozil...

    Comment linking /blog/computing/livejournal-mozilla-bug.html

    on “Saved 10 billion DNS queries per month by disabling DNS Prefetching”
  12. Submitted Writing Robust Bash Shell Scripts as a story · 4 points

    HN discussion
  13. See also: * https://www.shellcheck.net/ — linting tool to avoid common mistakes and improve your script * Bash Practices: https://mywiki.wooledge.org/BashGuide/Practices * Bash FAQ: https://mywiki.wooledge.org/BashFAQ * safe ways to do things in bash: https://github.com/anordal/shellharden/blob/master/how_to_do... * better scripting: https://robertmuth.blogspot.in/2012/08/better-bash-scripting... * robust scripting:…

    Comment linking /articles/writing-robust-shell-scripts/

    on “Bash Pitfalls”
  14. Submitted Writing Robust Bash Shell Scripts as a story · 2 points

    HN discussion
  15. wolfgang42 · 2017-03-23Recommends
    To expound on this: "set -e" is short for "set -o errexit", that is, abort the script if a command returns with a non-zero exit code. "set -u" is short for "set -o nounset", that is, abort the script if a variable name is dereferenced when the variable hasn't been set. I also strongly suggest reading http://www.davidpashley.com/articles/writing-robust-shell-sc... for more things that you should be aware of when writ…

    Comment linking /articles/writing-robust-shell-scripts/

    on “Diaspora-common: does 'rm -rf /' on purge”
  16. Submitted Writing Robust Bash Shell Scripts as a story · 2 points

    HN discussion
  17. westoque · 2015-05-22Recommends
    You could say the same for scripts, languages, etc when not using safety precautions. I would look at the link from erikb's answer: http://www.davidpashley.com/articles/writing-robust-shell-sc...

    Comment linking /articles/writing-robust-shell-scripts/

    on “Unix filesystems: How mv can be dangerous”
  18. Submitted Writing Robust Bash Shell Scripts as a story · 2 points

    HN discussion
  19. erikb · 2015-05-22Recommends
    Here's a good article about how it should be done. It does not just say "use move", but it also explains how to backup the old state, how to use traps to remove your workaround code etc. http://www.davidpashley.com/articles/writing-robust-shell-sc...

    Comment linking /articles/writing-robust-shell-scripts/

    on “Unix filesystems: How mv can be dangerous”
  20. Submitted Writing Robust Bash Shell Scripts as a story · 1 points

    HN discussion
  21. gruseom · 2011-01-02Recommends
    Looking for more about this, I found a pretty good post: http://www.davidpashley.com/articles/writing-robust-shell-sc...

    Comment linking /articles/writing-robust-shell-scripts.html

    on “Simple git workflow with hack and ship”
  22. On further inspection, I don't trust your implementation at all. You're blacklisting CSS rules and attributes rather than whitelisting them. This means you wouldn't catch attacks like this one, for example: http://www.davidpashley.com/blog/computing/livejournal-mozil... I also don't think you're the right thing when you DO find something that's not on the whitelist - you should be escaping it rather than stripping i…

    Comment linking /blog/computing/livejournal-mozilla-bug.html

    on “XSS war: a powerful Java HTML sanitizer”

Search all of HN for davidpashley.com

Linked by the same people?