|
|
|
|
|
by diablerouge
2167 days ago
|
|
This seems like a neat sed trick, but I'm not sure that it's useful for this particular case? When I write a shell script, I often write a help function if it's not a totally trivial script, but there's no need for this cryptic sed expression, right? You can just call `echo` a few times and do it the obvious way. That works better for maintainability and if you put it at the top of the file then it's immediately visible when opening or using `head` on it. Neat trick though - sed is super useful for all kinds of things. I had a co-worker who bound a keybinding to a sed one-liner that would automagically reconfigure some files that needed to be changed regularly. I ended up using that trick to allow for changing my terminal console colorscheme with a single command. |
|
But at any rate my typical usage() is generally along these lines (warning watch out for expansions):