Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by mixmastamyk on Wednesday October 24, 2018 @03:33PM
(#18295613)
Yes, though I prefer: echo ...
The reason is that you'll see expanded variables and wildcards before commiting to them.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by rcthompson on Wednesday October 24, 2018 @03:46PM
(#18295719)
But prefixing with echo only disables the first command in a pipeline, while commenting it disables the whole thing.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by groestl on Wednesday October 24, 2018 @03:56PM
(#18295806)
It also executes command and process substitutions, opens files etc. But granted, it's a useful trick in some cases, after passing the fat-fingering stage.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by mixmastamyk on Wednesday October 24, 2018 @06:36PM
(#18297061)
You can move the echo to the part you are currently working on.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by yread on Wednesday October 24, 2018 @04:09PM
(#18295892)
It's a pity you can't do something similar to SQL: when writing UPDATE/DELETE always write the WHERE clause first
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by rmetzler on Wednesday October 24, 2018 @04:16PM
(#18295946)
Something I learned early on when writing possible dangerous SQL selects:
CREATE TABLE mytable_backup AS SELECT * FROM mytable;
SELECT * FROM mytable WHERE condition;
DELETE FROM mytable WHERE condition;
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by traviscj on Thursday October 25, 2018 @03:41AM
(#18299188)
Or just let the DB work for you with BEGIN; + (select/update/delete) + COMMIT; or ROLLBACK;
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by jolmg on Wednesday October 24, 2018 @04:18PM
(#18295960)
What I like about SQL is that it's got the double safety of ";". To accidentally run a SQL statement before it's ready in a command line, you'd have to both add the ";" AND hit Enter, or have the bad practice of adding ";" before the statement is ready, or use a bad SQL command line that sees the ";" as optional.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by groestl on Wednesday October 24, 2018 @05:00PM
(#18296339)
I always start a session with BEGIN, write UPDATEs/DELETEs as SELECTs first and (if possible) use a staging database until I'm fine with the result.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by amalcon on Wednesday October 24, 2018 @10:49PM
(#18298263)
In SQL, you can at least wrap the whole thing in a transaction. Then, just roll the whole thing back if anything came out wrong.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by inopinatus on Thursday October 25, 2018 @02:59AM
(#18299024)
I usually SELECT COUNT(*) WHERE ..., and only subsequently overwrite with DELETE.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by androidgirl on Wednesday October 24, 2018 @03:52PM
(#18295778)
Thanks for the tip, I'll definitely be using this. Fear of accidental rm -rf * keeps me up sometimes.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by samstave on Wednesday October 24, 2018 @05:18PM
(#18296495)
Looks like you need to know about the 'sleep' command...
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by yesbabyyes on Wednesday October 24, 2018 @05:36PM
(#18296644)
unzip; strip; touch; finger; grep; mount; fsck; more; yes; fsck; fsck; umount; sleep
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by jxy on Wednesday October 24, 2018 @03:12PM
(#18295463)
`fc` helps. Setting `FCEDIT=ed` helps a lot.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe...
by no_news_is on Thursday October 25, 2018 @10:53PM
(#18306389)
This command can be dangerous itself.
For those who don't know... "The fc utility lists or edits and reexecutes, commands previously entered to an interactive sh."
A safety measure I picked up from a sysadmin while watching over their shoulder: start writing nifty command lines by prefixing them with # first, to prevent havoc when fat fingering the [enter].