Tag Archives: script

shellcheck: I should probably keep this around

I have all the programming ability of a wet dog. I am aware of that shortcoming though, and I try to keep things on hand that either (a) make me look like I know what I’m doing, or (b) will discreetly tell me when I don’t know what I’m doing, so as not to embarrass me in front of the hired help.

Hence my affinity for things like perltidy, tidyhtml and even txt2regex. ๐Ÿ˜›

Even if I don’t keep shellcheck installed, I’m keeping a bookmark to its online version, because it definitely lets me know when I’ve done something stupid.


That’s my goal in life: to stop doing stupid things. And shellcheck has already told me that I’m doing one or two in that script.

Things I like: the colored output, the arrow-pointers to tell me exactly where I made my mistake, and the error codes that I can use to get more information online. And by extension, the ability to exclude specific errors, if I know they are in there but don’t want to be teased about them.

Things I would suggest: It’s a little difficult to take some errors out of context, particularly if they break over a line or if something earlier in the script is related. As things stand, shellcheck only seems to point out lines that have errors, regardless of where they stand in relation to lines above or below.

As a side note, it seems like this is an obvious candidate for some kind of two-pane output display, with the text of the shell on one side, and an arrow-key-driven selector that bounces between errors, with the error code and explanation changing in a second panel, as the highlight moves. Imagine how some file managers show file information as you scroll through the contents of a directory, and that’s what I have in my mind.

But what do I know. Maybe I’m just dreaming, and what shellcheck has is good, but that’s what I’d look for in an updated version.

shellcheck in its local form is a bit of a heavyweight, when it comes time to build it. I usually have rotten luck with Haskell-based software, but this time the AUR package worked fine. The home page warns that you’ll need about 1Gb just to build shellcheck, and I think that’s where my machine peaked while it was building. So don’t put this together on your leftover 300Mhz K6 with 128Mb. You will regret it. ๐Ÿ˜ฆ

rename.pl: Many paths to the same destination

I have my own favorite renaming utility, but qmv is not the only way to get the job done.

Here’s a quick renaming script from perl-land, named — wouldn’t you know it — rename.pl.


I can’t say for certain who originally wrote the script, although the comment lines and the home page credit Larry Wall as the author. The site above is dated 2006, but they seem to give credit to a book published in 1999 as the source.

I don’t think it really matters; depending on your ability to express your renaming desires in search-and-replace strings, this might be more expedient than opening a text editor with qmv.

On the other hand, since that’s more or less the same thing that I do every time I use qmv with vim, maybe this is just a quicker approach to the same destination . ๐Ÿ˜

stats.pl: Voices from the dead

I am an eclectic, in the sense that I pluck my tools and gadgets from wherever I find them.

I enjoy digging through relics and seeing, for example, if there is anything useful in the corpse of a failed distro.

If you’ve been around Linux for a few years, you might remember Feather Linux, a Knoppix spinoff intended to work from a image under 128Mb.

Feather Linux is gone now; its home page is inaccessible and both Wikipedia and DistroWatch describe it in the past tense.

Such is life. But as luck would have it, at some point in the past, I scalped a small script — stats.pl — from the Feather Linux environment and made a note of it.

I hunted it down the other day and sure enough, probably four or five years after its creation and a few years after its demise, Feather Linux speaks to us from the dead.

2013-03-18-solo-2150-stats.pl-00 2013-03-18-solo-2150-stats.pl-01 2013-03-18-solo-2150-stats.pl-02 2013-03-18-solo-2150-stats.pl-03 2013-03-18-solo-2150-stats.pl-04

Similar to boxinfo.pl, stats.pl does a good job creating a series of basic HTML pages that will give you a rundown on your machine.

2013-03-18-solo-2150-stats.pl-05 2013-03-18-solo-2150-stats.pl-06 2013-03-18-solo-2150-stats.pl-07 2013-03-18-solo-2150-stats.pl-08 2013-03-18-solo-2150-stats.pl-09

Curiously, as you can see in some of those screenshots, stats.pl had some difficulty getting information. My video card, for example, is somehow invisible.

I can’t account for that, mostly because I have zero ability when it comes to picking through code.

It may be that this is an artifact brought about by changes in perl over the years, or it might be something eccentric in my hardware. Or it could be changes in the greater Linux structure.

Try it out and see if you get the same results. If so, we’ll call it stats.pl’s fault. If not, I claim responsibility.

And if you have the time and the skill, see if you can improve upon it. The world can always use another system profile script. ๐Ÿ˜‰

P.S.: One small hint: The web pages are created at /tmp/stat/. ๐Ÿ™‚

ical2rem.pl: Bridging the graphical and the textual

I use wyrd on a daily basis, the fantastic frontend to the planet-crushing power of remind.

But I also rely on a Google calendar for work-related stuff. Occasionally it becomes necessary to splice calendars together, and that’s when the fun starts.

Google allows you to export calendars into ics format, though a calendar’s Settings page. And ical2rem.pl converts them quickly into reminder format.

There’s nothing to see when this happens, so I don’t have a screenshot for you today.

But this wiki page will give you an idea how to set it up.

Personally I don’t bother with the cron job, like it suggests. It’s not often that I have to convert between them, and so once a month probably works for me.

The script is also in AUR, but it might be quicker just to download it. Have fun. ๐Ÿ™‚

P.S.: Apparently the script has either been rewritten or converted to ruby. I haven’t tried that. Let me know how it works. ๐Ÿ˜‰

boxinfo.pl: What it shows

Today’s gizmo is probably cheating; there’s nothing to show when boxinfo.pl runs — no interface, no nifty controls or multicolor output.


There’s nothing except perhaps a terse message, acknowledging it exists.

But just the same, the fun part is what it shows. In this case, it creates a cool-beans HTML file, beautifully formatted and designed, which shows every little detail about the host,


Very clever actually. I’m no HTML genius, but it seems like the output from this could be adapted to almost anything web-based, to show system specs.

So sure, the beauty of boxinfo.pl is what it produces, not what it does while it works. What it shows, really.

P.S.: Because you’re probably wondering. … Continue reading

gi-get.sh: Another nifty script

Some of the console “applications” I have collected are really just fancified scripts, some with proper interfaces, and some with little more than a progress bar.

Here’s one with a progress bar: gi-get.sh.


Rather clever, really: Give it a search term, and it trundles off to Google’s image search, and brings back the first 300 matches it can download.

I’ll be honest and say I don’t remember where I got this one. I e-mailed it to myself but didn’t make a note of where it came from. And the comments in the scripts aren’t very helpful.

It’s a good idea though, and seems to work without any issues. No logs to speak of, and no real information aside from the prompt and the progress bar, of course.

Keep in mind that this requires both wget and tidy, or your results will probably be … nothing.

This is one of those odd times when I’m at a loss for a source; I’m usually rather meticulous about where I get things. If you can give me a hint, I would appreciate it. ๐Ÿ˜

ncurses-life: Enjoy the show

The pipes script from yesterday isn’t really useful except as a screensaver or perhaps as something to inject into a screenshot for fun.

Since pointless text-based graphical gimmicks are the order of the day, here’s another one: ncurses-life.


Of course, there are hundreds of variations on Conway’s Game of Life, but this one will suffice.

The “game” itself is as old as the hills — I can remember studying the patterns and evolution as part of my secondary school classes.

It’s billed as a “game,” but that’s a classical definition, and so don’t go looking for commands or controls. Just enjoy the show.

pipes.sh: A little bit of fun

In light of the snow scripts from a few weeks ago, a pipes script might be fun too.

There are a lot of pipes scripts out there in the wild. Here’s one that works reasonably well.


Only one of those pictures is from my system. You can guess which one. (Oh — and keep in mind that your font needs to support the characters that draw the pipe symbols. ๐Ÿ™„ )

Oddly enough, I’ve had a few problems trying to run this script in some terminals; for example, a live Linux mint environment gives errors, as do a couple of others.

When it works though, it’s a clever trick. Thanks to the Unix screenshot sub-reddit for including a link to it. ๐Ÿ™‚

Ah … I almost forgot: For the naysayers who ask what good this could possibly be … remember screen’s idle setting. And thank me after you get it set up.

snow.sh, snow.py: More weather for you

This one is not so much an application as a simple shell script. Given the time of year though, snow.sh is fun to watch.


Its big brother, snow.py, does much the same thing, but uses a range of characters that actually look like snow.


Visually an improvement, but I should mention that if I try to use snow.py on my framebuffer machine, I get a flurry of … inverted question marks. ๐Ÿ˜€

Before you dismiss this as a three-second diversion, consider including it in screen‘s blanker options, as your terminal screensaver for winter moods. According to your hemisphere, of course. … ๐Ÿ˜

All the same, thanks go to sontek, and to a reddit submission that brought them to my attention.