Tag Archives: shell

color-invaders.sh: A script! and a site!

My favorite e-mails are the ones with lots of exclamation points. It’s usually a sign that someone is quite enthusiastic about the program they want to share. Or quite incensed at something I wrote. 😦

karl sent an orchard of exclamation points (happy ones, that is) on Saturday along with a note about color-invaders.sh, which apparently has its roots on the Crunchbang forums.

2015-02-26-6m47421-color-invaders.sh

And there you can see my very bland color scheme, which probably wouldn’t win any exclamation points from karl.

Aside from drawing the classic invaders in colors that you have set for your shell, color-invaders.sh doesn’t really do much. And there are lots of similar tools, that really only show what colors you set, so you can see if your desktop is something worth sharing with the wide, wide world. 😕

Part of karl’s enthusiasm though, was for a website that lets you experiment with colors and returns the codes necessary to implement them. karl didn’t say where that came from or if it was his own invention, but I don’t think it is.

I am sure there are other sites that similarly streamline the coding portion of custom shell colors; if there is a better one, feel free to mention it. And if you have a script or tool that displays shell colors in a more inventive fashion, pass it along too.

I am sure at least one person — mostly likely karl! — would be happy! to hear about them! :mrgreen:

P.S.: For what it’s worth, I don’t usually run a custom color scheme, and that’s by choice. A long time ago I was looking at the colors in a program and wondering why some things were hard to see, and realized I had inadvertently mashed two similar colors together, making the program somewhat difficult to read. I keep it plain now. Sorry, karl. 😉

Advertisements

go2: The obvious name for the tool

Last year’s avalanche of directory-switching tools is still reverberating in my ears. I would never assume I found them all, but I am pleased that I’ve found so many. Here’s go2, which is another of the same vein.

2015-02-10-r8-0acre-go2

go2 is a clever name, since your effectively asking to “go to” some place else. I can appreciate a witty name … although the more I think about it, maybe it’s not so much witty as it is obvious. 🙄

Append go2 with a string and it will try to find a directory in your tree that matches it. Give it the -r flag and it will search through all your root directory, which makes it quick and easy to jump across wide chasms in your system.

The first time you run go2, it will fit itself into your .bashrc, and from then on you can access its finer features without any hassle. Aside from that, I saw very little configuration that go2 needed.

If go2 runs into a situation where there is more than one option, it will prompt you for a choice. If your target is too fuzzy, that can take a little while.

go2 is in Debian, but I didn’t see it in Arch or AUR. go2 has a few other options that you might not see in other fast directory-switchers, but I will leave them to you to discover. To be painfully honest, cd and tab completion are usually enough for me.

If you need a little more oomph at the prompt though, this might be helpful.

bashmarks: The simple solution

We’ve been through plenty of fast-directory switchers, like j and j2, or z or popd and pushd, and a lot of others (and there are still more to come 🙄 ). But I don’t recall seeing something like bashmarks before, which lets you give a nickname to your path, and recall it in the future.

bashmarks works as a shell script you can either trigger through your .bashrc file, or source directly as you need it. The git package offers to “install” it to .local/bin, but I found it just as usable in its raw form, sourced with . bashmarks/bashmarks.sh whenever I felt I wanted it.

Once you’re hooked in, bashmarks gives you about five commands, all single letters that trigger or control nicknames to folders in your system: “s” saves a path, “g” goes to a path, “l” lists the bookmarks, “d” deletes one and “p” prints the path held in a bookmark.

And basically, that’s all.

kmandla@6m47421: /usr/src/nvidia-96.43.23$ l
downloads            /home/kmandla/downloads
home                 /home/kmandla
nvidia               /usr/src/nvidia-96.43.23

kmandla@6m47421: /usr/src/nvidia-96.43.23$ g home

kmandla@6m47421: ~$ g nvidia

kmandla@6m47421: /usr/src/nvidia-96.43.23$

bashmarks saves its data in ~/.sdirs, and I doubt anyone would complain if you wanted to hand-edit that file, and still move seamlessly around your system.

There are two big reasons I enjoy using this. The first is tab completion with bashmarks, which is such an obvious addition that it would be a huge mistake if it hadn’t been included. The difference between g d[TAB] to get to /home/kmandla/downloads and cd /h[TAB]/k[TAB]/d[TAB] is enough to make bashmarks a useful tool.

The other reason is more philosophical, I suppose: If I was going to create some sort of “fast directory switching” tool, it would probably work like this. It’s the most obvious solution to me.

I’ve seen a lot of other directory switching tools that use stacks or frequency or priorities to try and analyze and predict where I want to go. bashmarks takes the simple path, lets you assign names, and goes where you tell it. And it does that without compiling intricate binaries, background daemons or gnarled dependencies.

It’s even got a tiny bit of color. 😉

And since I’m feeling generous today, and because it does such a bang-up job, I’m going to give out a K.Mandla gold star to bashmarks: ⭐ Don’t spend it all in one place. 😉 Enjoy!

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.

2014-07-16-6m47421-shellcheck

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. 😦

mosh: I see the what, the where, the how … but the why?

I don’t ever recall hearing a discouraging word about ssh, which easily ranks among my top three coolest tools ever.

I wouldn’t say it’s without faults though, and I assume that’s the reason why there’s mosh.

I’ve had hanging connections in ssh, particularly if I shut down a machine while still connected. I don’t know if mosh would help with that or not, but judging by its description, it might be a better tool if ssh is causing problems.

But I don’t know how to show that, in a screenshot.

2014-01-15-lv-r1fz6-mosh

I guess if you have a poor connection and you’ve seen ssh misbehave, mosh might be a better application for remote connections.

As it is, I’m just connecting between two machines on my desktop here. And barring a lighting strike, massive solar flare or a meteor crashing through the roof, interference is unlikely.

So all the pieces are obvious and I can figure out how to work it. I just … don’t … know … why. … 😦

kibitz: A favorite of backseat drivers

Buried in a package called expect is a utility that seems to have a lot of potential: kibitz.

Or at least, it should have had some potential, when it started out in this world way back in 1994. 😯

2013-12-15-lv-r1fz6-kibitz

(I know, that’s a lousy screenshot. I don’t know what I’d show if I did get kibitz running though. Stock photo of two people typing at computers? 🙄 )

If I understand it correctly, it should allow two users to piggyback in the same shell, watching each other type and offering help when necessary.

For me, it didn’t seem to want to work; I tried to kibitz from root to the kmandla account, but kept getting “write permission” messages.

I think I understand how it should work though, and I like the idea, generally speaking. Although two people typing in the same shell sounds like a recipe for a wheel war.

I did have better luck with screen -X though, many long years ago. If kibitz is still doing as it promised almost 20 years ago, it’s a worthy application no matter what I say. 😯

Bonus: Missing … presumed having a good time

I am a little shy these days of listing applications I suspect are dead. It didn’t work out well last time.

But I suppose this is one small way of soliciting assistance from beyond my own four walls. Without further ado. …

  1. redrogue bills itself as a side-scrolling nethack, but the AUR version segfaults for me, and Debian doesn’t carry it. Which is a shame really, since the flash version is kind of fun. Then again, maybe there is no console version. … 😐
  2. I think I found argus while I was looking at aide. Unfortunately the AUR version wouldn’t build, even if the build notes were amusing. Half a point, sir.
  3. elmo has been on my wish-list for the better part of a decade, and it still just doesn’t seem to have anyone’s love or attention. We were promised a new developer four years ago, but that panned out too. Efforts to build it on my own were met with looks of disapproval from my terminal screen.
  4. I could swear I have seen alleytris at work, but all my attempts created hideous streams of errors at the console. Remind me if I have somehow overlooked a winner here.
  5. raggle I am very sure I have used. In fact, I wrote about it a few years ago. Since then though, Debian has apparently dropped it, Ubuntu has it but only in Hardy, and I can’t get that version to splice with Linux Mint because of dependency issues. Oh, and the AUR version goes bonkers. I can take a hint. …
  6. amap in its AUR form supposedly was updated only a few months ago. I had no luck building it though. And Debian apparently doesn’t carry it.
  7. tdu is another one I am sure I have tried before, but the newest builds just hang when I try to run it, and again, Debian doesn’t keep this one in its repertoire.
  8. adresownik I believe is an address book in console form, but the home page was inaccessible to me last time I looked, the source link was likewise dead and Debian again, doesn’t know about this one. I even went so far as to scour the world of ftp sites, hoping to dig out an old source tarball. No luck.

I think that about does it. If there’s anything here that jumps out at you, or if you find it lurking in some dark corner of the web, crying … send me a note.

I don’t mind admitting when I’m wrong, wrong, wrong. :mrgreen:

Edit, 2 p.m.: niski pointed out that adresownik is apparently back online. 🙂