Start all of your commands with a comma (2009)
51–60 of 130 posts
Re: Start all of your commands with a comma (2009)
#52Re: Start all of your commands with a comma (2009)
#53 function .routes() {
if [[ $# -eq 0 ]]; then
.rails routes
else
.rails routes | grep $@
fi
}
where .rails is another alias (for running bundle exec rails ...). I can then run ".routes webhook" and see all routes containing "webhook".Last but not least, I automated the whole thing with bash-ctx (https://github.com/gregnavis/bash-ctx).
Re: Start all of your commands with a comma (2009)
#54Earlier quoted context omitted.
It can if you are executing programs that then try to execute those commands and get your commands instead.
I wish it was easier to create "snapshots" of a particular set of environment variables in order to use them later as run environments. I also wish that Unix desktop environments generally made it easier to manage env vars, but that's another complaint. And don't get me started on PAM env vars...
docker gives you this (but only as part of a whole ecosystem, which for various reasons you might not want to hitch your horse to).
Re: Start all of your commands with a comma (2009)
#55Quoted post unavailable.
If you wanted to juice-up your karma (I can't fathom why someone would bother doing this), it seems like simply reposting popular submissions from previous years is a very easy way to do that (if it was popular on HN in years past, then it's likely it would again). I'm not saying that's Tomte's motivation.
This would also result in interesting/popular submissions resurfacing again and again, which anecdotally I can say I've seen quite a bit on HN. I don't think that's necessarily a bad thing, but perhaps it can get tedious for some. For example, I had not read this post before and found it useful/interesting.
Re: Start all of your commands with a comma (2009)
#56I do something a bit special... Instead of naming my script foobarnator (and hence risking that another foobarnator may exist in the future and may clash with my script), I name my script foobarnatorToBeAliased.sh . Then in my list of aliases I alias foobarnator to foobarnatorToBeAliased.sh . The alias itself looks a bit weird in that to pass arguments to an aliased command you need to use a function (in Bash at leas…
What has always been a blocker for me to follow your example, is the desire to use many such scripts from the command lines provided inside an $editor or $email client. There probably is a way to configure both of them to see the aliases, but it's more straightforward to just have everything in the PATH.
Re: Start all of your commands with a comma (2009)
#57Re: Start all of your commands with a comma (2009)
#58Clever trick. Too bad there's no good way to namespace commands. It would be interesting if you could have, for instance: $ mkdir -p /tmp/bin/my $ printf '%s\n%s\n' '#!/bin/sh' 'echo hello' > /tmp/bin/my/hello $ chmod 755 /tmp/bin/my/hello $ PATH="/tmp/bin:$PATH" $ my/hello hello
> mkdir -p /tmp/bin/my This is not a secure way of using /tmp.
edit: Or I would fix it, but I guess I can't edit it. Oh well.
Re: Start all of your commands with a comma (2009)
#59Earlier quoted context omitted.
Until you have five commands which all use the prefix `sort-incoming-` and then three commands named `sort-incoming-hourly` and `sort-incoming-monthly` etc.
It would be nice to have camel-case completion in the shell, i.e. have “SIH” be completed to “SortIncomingHourly” and “SIM” to “SortIncomingMonthly”, etc. (only for upper-case characters). That way one could get more mileage out of the possible character combinations.
That allows me to type `soriloco`, punch ctrl+r and be prompted with `some ridiculously long command` (if, of course, I've run it before).
Combined with infinite history this trick has saved me a bunch of typing and even proper remembering. :P
Re: Start all of your commands with a comma (2009)
#60Clever trick. Too bad there's no good way to namespace commands. It would be interesting if you could have, for instance: $ mkdir -p /tmp/bin/my $ printf '%s\n%s\n' '#!/bin/sh' 'echo hello' > /tmp/bin/my/hello $ chmod 755 /tmp/bin/my/hello $ PATH="/tmp/bin:$PATH" $ my/hello hello
Plan 9 does that, I'm not sure why it never made it into Unix because I always loved it. Your networking-related commands were in `/bin/ip` and you'd run e.g. `ip/ping 1.1.1.1`. If you created the dir `$home/bin/rc/my` and put scripts in it, they would have been runnable as `my/hello` etc like in your example.