Viewing profile — rgrau
rgrau
HN member- Joined
- Mon, Jun 11, 2012, 1:15 PM UTC
- HN karma
- 524
- Public activity
- 126 items
- HN profile
- View on Hacker News ↗
About rgrau
- https://puntoblogspot.blogspot.com
Recent public activity
-
comment
Comment #49061145
So true. I think most of us who learned "advanced" bash is after being tired of feeling like an idiot looking at long bash scripts. Usually, those scripts are written by people who…
-
comment
Comment #49056388
Nice one! I love those weird bash tricks. Some of the examples here are interesting, but they show parameter substitution more than colon itself: https://tldp.org/LDP/abs/html/para…
-
comment
Comment #47534690
aha! I see what you mean, it's indeed a nice option, yep. Using brackets like this is something I never thought of, and it's probably why it's hard for me to process it, but I can …
-
comment
Comment #47533334
That's very cool! To take advantage of the "leading space" one, I have this, to mark some commands that I never want to record: unhist () { alias $1=" $1" } unhist unhist unhist fz…
-
comment
Comment #47533257
for multiline pipes, it's WAY better to format like foo | bar | baz You don't have to use backquotes, AND, it allows you to comment line by line, because there's no backslash messi…
-
comment
Comment #47528565
A similar trick: #!/bin/sh $* that's my `~/bin/noglob` file, so when I call a zsh script from bash that uses `noglob`, it doesn't blow up.
-
comment
Comment #44314454
I use a variant with ssh and some compression: docker save $image | bzip2 | ssh "$host" 'bunzip2 | docker load'
-
comment
Comment #37610213
You can also nest those, so this way you can get a value from an argument, or an env var, and if none is set, error. echo "${1:-${env_var:?I need a value for that!}}"
-
comment
Comment #37240952
Here's a solution in k, that uses a similar array oriented approach: &2=+/~x!/:\:x:!100 I wrote a little explanation of it, in case anyone is curious about how it works: https://gi…
-
comment
Comment #36411636
I couldn't find a way to have more than one callback per signal, and created a system to have an array of callbacks: https://github.com/kidd/scripting-field-guide/blob/master/bo...…
-
comment
Comment #36338530
Yep, good point. They are useful when you want to change the whole text inside the delimiters (and IME, it's most of the times), but they do different things than cf( because they …
-
comment
Comment #36337619
I have 2 use cases for cf), but I don't use it a lot in the end: One is when inside a parenthesis, and wanting to really delete till the closing parenthesis. But that would leave a…
-
comment
Comment #36125345
Another advantage of pipes at the end is that you can comment lines and the full pipeline still works. Some time ago I wrote a bunch of tips to make more ergonomic bash scripts: ht…
-
comment
Comment #35651635
Here's where he explains how he did it: https://www.youtube.com/watch?v=ORjyXcLDd9M
-
comment
Comment #33355344
Oh, I hadn't noticed that links are not highlighted as such (unless already visited). Fixed, thanks!
-
comment
Comment #33355246
Fixed, thanks!
-
comment
Comment #33354744
> If appropriate, change to the script’s directory close to the start of the script. > And it’s usually always appropriate. I wouldn't think so. You don't know where your script wi…
-
comment
Comment #28303363
Oh! I didn't know that one could build an arbitrary string like that inside a map. Thanks a lot for that, I agree it looks better!
-
comment
Comment #28299196
A very useful function in jq is "join", which I use a lot to cook the final shape of the data (many times used with fzf/dmenu) Here's a simple way to list and browse github issues …
-
comment
Comment #28006777
Even funnier when you realize bash and zsh do different things (by default) there. foo="ls -las" $foo "$foo" for zsh to split words, `setopt SH_SPLIT_WORDS`.
-
comment
Comment #27739600
Yep, sorry about that, I meant in general. This particular case is fine, and I am grateful for that.
-
comment
Comment #27739319
yes! that looks super useful indeed. Thanks!
-
comment
Comment #27739112
What I miss most about those collections is that they are browser based, and when I'm programming, if I need the music to stop, or I get a call, or something, I have to go find the…
-
comment
Comment #27730239
thanks so much! I'll fix all those right away :+1:
-
comment
Comment #27729506
wow, that's a great one!