{
  "$type": "site.standard.document",
  "canonicalUrl": "https://rednafi.com/misc/pesky-little-scripts/",
  "description": "Organize custom scripts with comma-prefixed naming. Improve tab completion and eliminate clutter by prefixing script names with special characters.",
  "path": "/misc/pesky-little-scripts/",
  "publishedAt": "2023-10-29T00:00:00.000Z",
  "site": "at://did:plc:fgtm2c26vfcj74rfmeggbyqj/site.standard.publication/3mnl6f7ob462z",
  "tags": [
    "Shell",
    "Unix",
    "CLI"
  ],
  "textContent": "I like writing custom scripts to automate stuff or fix repetitive headaches. Most of them\nare shell scripts, and a few of them are written in Python. Over the years, I've accumulated\nquite a few of them. I use Git and [GNU stow] to manage them across different machines, and\nthe [dotfile workflow] is quite effective. However, as the list of scripts grows larger,\ninvoking them becomes a pain because the tab completion results get cluttered with other\nsystem commands. Plus, often I even forget the initials of a script's name and stare at my\nterminal while the blinking cursor facepalms at my stupidity.\n\nI was watching this [amazing talk by Brandon Rhodes] that proposes quite an elegant solution\nto this problem. It goes like this:\n\n> All your scripts should start with a character as a prefix that doesn't have any special\n> meaning in the shell environment. Another requirement is that no other system command\n> should start with your chosen character.\n\nThat way, when you type the prefix character and hit tab, only your custom scripts should\nappear and nothing else. This works with your aliases too!\n\nThe dilemma here is picking the right character that meets both of the requirements.\nLuckily, Brandon did the research for us. Turns out, the shell environment uses pretty much\nall the characters on the keyboard as special characters other than these 6:\n\nAmong them, the first 5 requires pressing the Shift key, which is inconvenient. But the\nplain old comma , is right there. You can start your script or alias names with a comma\n, and it'll be golden.\n\nMy tab completion looks like this:\n\nAll my aliases start with , too so that they also appear in the list with the custom\nscripts. Fin!\n\n\n\n\n[gnu stow]:\n    https://www.gnu.org/software/stow/\n\n[dotfile workflow]:\n    /misc/dotfile-stewardship-for-the-indolent/\n\n[amazing talk by Brandon Rhodes]:\n    https://www.youtube.com/watch?v=pybtvFFRYFs",
  "title": "Pesky little scripts"
}