Hacker News new | ask | show | jobs
by vlowrian 878 days ago
For any shell command where a minor mistake has the potential of ruining your day, take a look at “try”, which will allow you to inspect the effects before running it against a live system: https://github.com/binpash/try
2 comments

> Please note that try is a prototype and not a full sandbox, and should not be used to execute commands that you don't already trust on your system, (i.e. network calls are all allowed)
True, ‘try’ won’t make reading and understanding a command obsolete, but it’s a great tool to prevent accidental deletion of important files, like OP described.
I was taught that Try was to be sure your command was well formed, if its a complex command with some regex for example...

Though I have not used it much over the years, as I havent had to do much personal regex for a long while.

That's a great tool! Hope OP's sees this. If the default would be to use "try" when using shelly and I just had to "commit [Y/n]" at the end, then I would seriously consider using it. One could do something like `shelly "my description" --force` to bypass the "try" usage.