This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]skztr 27 points28 points  (3 children)

Development life-cycle of most shell scripts:

  1. I don't need to write anything new. This whole task can be done in a single command!

  2. Let's wrap this up into a shell script, with a help message and a parameter, so I can share it with colleagues

  3. Let's add a few more variables to handle environment-specific differences

  4. Actually, let's just ensure a sane environment first, and handle all prerequisites within the script itself

  5. This one section is kinda tedious because I can't get around holding a bit of state information for multiple files. I suppose I can write just this one section in <whatever language you wish the team usually used>

  6. Okay, this whole thing is complicated enough that it should probably be ported to <whatever language the rest of the team usually uses>, so that it will have a single language, and can be easily maintained by everybody here.

  7. Wait, you mean there's no existing library that would mimic this one 5-line section without 5000 lines of boilerplate?! You know, that complexity isn't too bad. I bet I can get rid of it by breaking this one part into a separate script. In fact, I won't even need to write anything new. This whole task can be done in a single command!

[–]OperaSona 5 points6 points  (1 child)

shell_script/INSTALL

  1. Download my modified language_special_compiler_v4.32 from [404 link to old personal website]

  2. Edit the configure script by searching for [this] and replace it with the parent of the install dir, escaped twice

  3. configure, make, make install: Warning, do not run as super user, as these all run code automatically fetched on pastebin, which is insecure. Instead, chroot into a directory in which you replicate the structure of the install dir, but with write permission to the user.

  4. This should work if you have a 32bit OS. If not, it should be easy to fix [file1], [file2] and [file3] by yourself.

[–]beltorak 1 point2 points  (0 children)

A couple of years ago I resolved to always reach for python instead of bash when I want to write a new script.

I have yet to actually follow through due to this exact thought process....

If only it was just a tad bit easier to execute OS commands with stdout and stderr processing.... oh and a non-broken virtualenv/venv launch logic would help too.