4 ms·
The most useful script I wrote is one I call `posh`. It shorten a file path by using environment variables. Example: $ posh /home/ramrachum/Dropbox/notes.txt
by cool-RR 1y ago
The most useful script I wrote is one I call `posh`. It shorten a file path by using environment variables. Example:
$ posh /home/ramrachum/Dropbox/notes.txt
$DX/notes.txt
Of course, it only becomes useful when you define a bunch of environment variables for the paths that you use often.
I use this a lot in all of my scripts. Basically whenever any of my script prints a path, it passes it through `posh`.
- oneeyedpigeon 11mo agoI'd love to see this script. Does it use `env` and strip out things like PWD?
- cool-RR 11mo agoI wrote it in a way that's too intertwined with my other shit to be shareable with people, but honestly you can copy-paste my comment to your friendly neighborhood LLM and you'll get something decent. Indeed it uses `env`.
- oneeyedpigeon 11mo agoUnderstood. I'd rather write it myself from scratch than use an LLM; confirmation of the general process should be enough, I hope!