Live data from Hacker News

Start all of your commands with a comma (2009)

rhodesmill.org

71–80 of 130 posts

Re: Start all of your commands with a comma (2009)

#71
post #47

Earlier quoted context omitted.

Do you know any of the history of why your link to `.../Shopify/...` redirects to `.../nix-community/...`? Is the latter an open-source contribution by Shopify?

I think it was originally developed and maintained by Shopify, but was then handed off to the nix community

Correct. Source: I used the shit out of that command. Thanks Burke

Re: Start all of your commands with a comma (2009)

#72
post #65
post #46

clever idea, but does it need such a long post to describe?

Two phone sized screenfuls of text is too long now? I'm genuinely interested to know whether you read longform text at all.

I mostly read books. I don't want to pick on the author, but since you asked I will be more specific: this idea would fit in a tweet.* It's a good idea, but the long build up reminds me of recipe sites.

* I just use "tweet" as a unit of measure, like "the size of two elephants". I do not advocate the use of twitter.

Re: Start all of your commands with a comma (2009)

#73
post #39
post #8

Clever 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.

no matter which kind of twisted idea someone comes up with related to terminals, there is always a guy who chimes in with "in Plan 9 you can do that...". It makes me smile every time. :)

Re: Start all of your commands with a comma (2009)

#74
post #36

Earlier quoted context omitted.

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...

Just env vars? env > "$(date +s).env-snapshot" (And use it again slightly more awkwardly as or something more convenient to `cmd`.)

Should be

  

Re: Start all of your commands with a comma (2009)

#75
post #25

I tend to give programs longer, more descriptive names and then do the short names as shell aliases. That way there’s little risk of name collision for the original program, scripts using the canonical name remain readable, and the shorthand is free to evolve to fit varying work habits.

Why do the names have to be shorter, I never have to type it all out just the first couple of letters and then autocomplete. Dealing with aliases/“shortcuts” is such a pain plus I hate that pattern anyways.

Re: Start all of your commands with a comma (2009)

#76

I 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…

I used to do this, but it doesn't work with things like "watch".

I actually just learned from a different HN thread yesterday [1] that aliases do get expanded if you add this to your shell's rc file:

    alias watch='watch '
Specifically, if an alias ends with a space, it will cause the subsequent arg to be expanded as well. For example, try running:

    alias beep=echo
    watch beep hello # This will fail
    alias watch='watch '
    watch beep hello # Now it works!
[1]: https://news.ycombinator.com/item?id=31830879

Re: Start all of your commands with a comma (2009)

#77
post #8

Clever 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

What about:

  my hello
I.e. only my needs to be in the global namespace and all other commands are resolved by my itself.

Re: Start all of your commands with a comma (2009)

#80
post #66

I 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…

> 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 least AFACIT) but it all works fine. No you don't: $ alias say=echo $ say beep beep You do need to do something special the other way around (if you wrap a command in a function it needs to explicitly pass the arguments on).

Another advantage of aliases: in zsh at least, autocompletions of the aliased command Just Work (it breaks in wrapper functions)
Post reply on HN