I'm .ok you're .ok: introducing folder profiles for bash and powershell
.ok file holds a bunch of handy one-liners, specific to the folder it is in. It can be viewed or executed with a simple command. It makes you smarter and more efficient.
I work on lots of little projects and each one has its own nuances and tricks. Context switching from one project to the next is hard on the brain. Some projects are brand new, some are ten years old. Some are in Windows, some are in Linux.
Every time I go to resume work on a project there is that moment of confusion as the brain tries to reload a dusty tape of facts from cold storage.
To make it easier to recall all pertinent facts, I've started putting a little file called ".ok" in each project. This file holds any relevant shell commands I use with that project. (I have a powershell version and a bash version)
For example here's the
.ok file from my "Today I Learned" project:
.\quick.ps1; .\deploy.ps1; # quick-build, prepare to deploy .\build.ps1 # complete build, after which you can see preview _book\index.html # see preview .\wordcount.ps1 # custom word count script
If I type the command "
ok" then I will see a listing of this file with a number against each line:
> ok 1. .\quick.ps1; .\deploy.ps1; # quick-build, prepare to deploy 2. .\build.ps1 # complete build, after which you can see preview 3. _book\index.html # see preview 4. .\wordcount.ps1 # custom word count script
And if I type "
ok 3" then it will run line number
3, like this:
> ok 3 > _book\index.html # see preview
(And in this case I'll see a HTML preview of the current state of the book)
To make "
ok" extra useful, I've setup my system so that every time I navigate into any folder (via
cd), the command "
ok" is run immediately. So if there is a "
.ok" file I'll immediately see the available commands. (I did this by removing the "
cd" alias, and making a custom "
cd" function that does a
set-location followed by a call to "
If I want to add a command to the file, it is the work of a moment. I can do it immediately by editing the "
.ok" file with "
ed" or any standard editor.
Source code is here:
"ok" folder profiles for powershell
Sometimes I write a thing and slowly stop using it. Other times I use it more and more, day after day, year after year, as happened with NimbleText. So far, "ok" seems to be one of those "use it more and more" solutions. So I think you would do well to give it a try.
Any issues, lemme know.Next → ← Previous
My book "Choose Your First Product" is available now.
It gives you 4 easy steps to find and validate a humble product idea.