Live data from Hacker News

Start all of your commands with a comma (2009)

rhodesmill.org

241–250 of 252 posts

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

#241

Earlier quoted context omitted.

Naming a file with a "-" as the first character means you have to be careful to use "--" with commands to signify the end of options as otherwise the filename will be interpreted as being additional options with unexpected results. e.g. ls -l -- * Even when you're not deliberately operating on the commands, it's too easy to get caught out by it with wildcards etc.

Sure, but this would be contained to when your CWD is ~/bin or ~/.local/bin (or wherever you put your "-" scripts in).

Yes, but it doesn't make it a good idea to leave potential traps lying around even if they're in a different room.

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

#242
post #123

Earlier quoted context omitted.

How does your sandbox ruleset look? I've been using containers on Linux but I don't have a solution for macOS.

Here's my ruleset https://gist.github.com/eugene1g/ad3ff9783396e2cf35354689cc6... My goal is to prevent Claude from blowing up my computer by erasing things it shouldn't touch. So the philosophy of my sanboxing is "You get write access to $allowlist, and read access to everything except for $blocklist". I'm not concerned about data exfiltration, as implementing it well in a dev tool is too difficult, so my rules are…

> Here's my ruleset ...

Thank you for sharing a non-trivial working example of a sandbox-exec configuration. Having an exemplar such as what you have kindly shared is hugely beneficial for those of us looking to see what can be done with a tool such as this.

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

#244
post #73
post #23

Every tool and shell that lay in arm's reach treated the comma as a perfectly normal and unobjectionable character in a filename. WTF. After 40 years maybe I should have figured that one out.

You never used CVS/RCS with its “,v” files?

My introduction to RCS was indeed spurred by a command typo!

I was learning Pascal on AT&T 3B2 systems. They were running SVR3. Perfectly normal clustered systems with nifty things like RFS. We were all logged in via dumb terminals, and the machines were sequestered on another floor. I had pictured them as big, really big. But 3B2s were not.

Anyway, our first lessons were how to use the Bourne shell and how to use "vi" to edit our source code.

I had learned to type 4 years previously, so I was already fast and fearsomely accurate. But I still made mistakes.

So one day I typed "ci filename.p" and then I had an hour's worth of sheer horror!

"ci" had not spawned the visual editor as I had hoped, but it did something inexplicable to that file! It had renamed it to "filename.p,v" and had put a bunch of garbage into it!

I can't remember how much "RCS garbage" was inserted, or how much cleanup I needed to do. For some reason, our TA/lab assistants were not available for me to ask! I was in a cold sweat, because all my hard classwork had been utterly mangled by this unfeeling machine, and I didn't know how to effectively undo it.

Eventually I learned about the RCS system, and what those curious "$...$" symbols meant, and I think I worked out a way to "undo" it (which I think consisted of merely "co" to checkout the file again.)

But it was a rude awakening to the fact that simple command-line typos could have some very unintended consequences!

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

#245
post #123

Earlier quoted context omitted.

Here's my ruleset https://gist.github.com/eugene1g/ad3ff9783396e2cf35354689cc6... My goal is to prevent Claude from blowing up my computer by erasing things it shouldn't touch. So the philosophy of my sanboxing is "You get write access to $allowlist, and read access to everything except for $blocklist". I'm not concerned about data exfiltration, as implementing it well in a dev tool is too difficult, so my rules are…

> Here's my ruleset ... Thank you for sharing a non-trivial working example of a sandbox-exec configuration. Having an exemplar such as what you have kindly shared is hugely beneficial for those of us looking to see what can be done with a tool such as this.

Thank you - you inspired me to open-source this work properly -> https://eugene1g.github.io/agent-safehouse/

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

#246
post #245

Earlier quoted context omitted.

> Here's my ruleset ... Thank you for sharing a non-trivial working example of a sandbox-exec configuration. Having an exemplar such as what you have kindly shared is hugely beneficial for those of us looking to see what can be done with a tool such as this.

Thank you - you inspired me to open-source this work properly -> https://eugene1g.github.io/agent-safehouse/

> Thank you - you inspired me to open-source this work properly

It is both myself and the OSS community which thank you.

  Great things are done by a series of small things brought 
  together.[0]
0 - https://www.brainyquote.com/quotes/vincent_van_gogh_120866

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

#247
post #209

Earlier quoted context omitted.

As a non-native English speaker and writer/typer I'm not well versed in usage of commas unfortunately. Feel free to add the required ones while reading this comment. Sorry for the inconvenience this might create.

This is an example of the difficulty in expressing tone through text. Meant it as a passing lighthearted observational joke. No inconvenience at all.

Haha, I actually assumed you were making a joke from the beginning, it'd be funny to think that the habit of using comma prefixed commands will make someone more likely to use commas in their sentences.

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

#248

I didn't like the idea. I prefer the alternative approach: _I_ decide the order of dirs in the PATH env. If I introduce an executable with a name, that overrides a system one - I probably do that intentionally. If I introduce an alias (like `grep='grep --binary-files=without-match --ignore-case --color=auto`) that matches the name of a system binary - I probably do that intentionally. And if I EVER need to call grep…

> I just prefix it with a backslash: \grep I have an almost identical grep alias. Word of warning, I use `\grep` quite frequently. The usage is when you are piping after grep or saving to a variable. Illustrative example: $ TO_DL=$(curl "https://foo.com/releases/" \ | grep -e "latest" \ | head -n1 \ ) $ curl $TO_DL curl: (3) bad range in URL position XX https://foo.com/releases/latest.tar.gz ^^^^^^ Annoyingly `--colo…

most pipe-friendly commands check if stdout is attached to tty or not, and if not, they drop the extra color/formatting. so grep --color=auto shouldn't output color during pipes.

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

#249
post #23

Every tool and shell that lay in arm's reach treated the comma as a perfectly normal and unobjectionable character in a filename. WTF. After 40 years maybe I should have figured that one out.

You may enjoy learning about the [ binary.

Tried to look it up but my Google-fu failed me

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

#250

Earlier quoted context omitted.

Yes??? :) I'm not the crazy one here! That's a whole two characters on the same side of the keyboard...

How often do you find yourself running executables from the current directory? Is this a daily thing?

Gamedev! I could run some crazy cmake command to build and run, or I could just bin/build.
Post reply on HN