• 0 Posts
  • 91 Comments
Joined 1 year ago
cake
Cake day: June 26th, 2023

help-circle







  • Yes. And many people here doesn’t seem to get that.

    I’m not a dev of any kind. I occasionally write some bash and awk scriots to automate some things and if I need some kind of plain text (non-binary) data format I prefer tsv over json.

    So why do I still get this? Is it just that many json advocates want to make sure others know json does support other data types than plain string?


  • Zucca@sopuli.xyztoLinux@lemmy.mlbash coding standards?
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    2 months ago

    I would then assume those scripts weren’t written properly to begin with.

    But yes, shell scripts should be used (normally) to automate some simple tasks (file copying, backups…) or as an wrapper to exec some other program. I’ve written several shell scripts to automate things on my personal machines.

    However shell script can be complex program while at the same time being (somewhat) easy to maintain:

    • functions, use functions, alot
      • comment every function and describe what it expects in stdin or as an arguments
      • also comment what it outputs or sets

    This way at least I don’t break my scripts, when I need to modify a function or some way extend my scripts. Keeping the UNIX philosophy inside shell scripts: let one function do one thing well.

    And of course: YMMV. People have wastly different coding standards when it comes to personal little(?) projects.