Tag Archives: shell

Bash / Zsh customization

AAPL changed the default shell from bash to zsh in either Mojave or Catalina. I ignored that, since nothing they’ve done lately betrays any understanding of Unix. But even after I moved back to bash using chsh, my Mac keeps reminding me that I’m doing it wrong. So I thought to myself: what if I did migrate to zsh? Or, rather, what’s keeping me from doing it? (Aside from AAPL being the ones to recommend it, I mean.)

Well, I know bash syntax pretty well, and I’ve got a bunch of shell scripts I wouldn’t want to find the bash-isms in. But OSX still includes bash, so running a shell script in bash is as simple as putting the right shebang up top. Assuming you have shell initialization working.

I do have it working. I think. I never know for sure. It’s a baling wire and chewing gum contraption, I admit.

The problem is that bash initialization is impossible to figure out. And even if you do figure it out, then you have to figure out what /etc/profile and /etc/bashrc and who-knows-what are invoking and in what order.

But if I don’t figure it out, I’ll always be to afraid to find out if zsh is worth using. Fortunately, I have a handy guide I can use to get a zsh initialization working.

Mini Magick

I just discovered MiniMagick. It is exactly what I was looking for in a ruby-language wrapper for ImageMagick.

I’ve been using ImageMagick forever. Like, more than 20 years foreer. Maybe 30 years;  I don’t know when it was first developed, or how old it was when I discovered it.

Some of the time, I use ImageMagick from the command line: just convert a file or montage a couple of them, or whatever. But sometimes, I do the same three things to an image and expect to do it over and over again for multiple images, I’ll write a shell script.

Writing shell scripts is hard. (Like, do you use trap? Of course you don’t.)

Writing Ruby is easy. But the only Ruby wrapper for ImageMagick I knew about was RMagick, which is big and complex and the first couple of times I tried to use it I had build problems (this was back before gems and github).

So there I was. Use bash and keep it simple, or use ruby with some crazy backtick `convert foo.png foo.jpg` shell escape there instead of doing it right.

But MiniMagick is just a well-designed wrapper around those backticks. Kudos!

Command Line Interfaces of the Future

This cracks me up: the Windows 8 server is going to nudge, and eventually force, administrators to give up their point-and-click interfaces in favor of something a little more up-to-date.

(I could have told you they’d eventually wind up here, after struggling for years with COMMAND.COM and CMD.EXE, only to see them finally produce a halfway decent shell—long after I’d moved on.)

(Via RedmondMag via someone I’ve forgotten (sorry).)