Skip to main content

Timeline for one-liner vs script

Current License: CC BY-SA 4.0

7 events
when toggle format what by license comment
Oct 11 at 5:04 comment added Gilles Quénot Why a limit to 80 chars? Are you a COBOL dev or still using IBM punch cards? ^^
Oct 3, 2019 at 12:46 comment added cas @PeterCordes moving the cursor very fast doesn't even begin to compare with what you can do in a decent editor like vi/vim. btw, ^X^E invokes $EDITOR or $VISUAL in bash (and some other shells. zsh too, i think. configurable). it's a good way of turning the unreadable mess I've created into something comprehensible by inserting line-feeds and indentation - it's easy to get lost in nested braces or brackets without them. BTW my terminal windows are over 250 characters wide, so my one-liners can get very long even without wrapping.
Oct 3, 2019 at 10:37 comment added Peter Cordes Also, IIRC some shells (like ZSH I think) have a keybind to invoke an editor on the current command line, allowing you to compose a "one-liner" in your favourite editor and easily get that into command-history for further up-arrow and editing. (Being able to modify it for re-runs is what makes one-liners great, vs. handling command-line options in a script.) IIRC, bash has external edit, too, but not bound to anything by default.
Oct 3, 2019 at 10:35 comment added Peter Cordes @cas: with control-arrow-key (or alt+f / alt+b) you can move around in a one-liner very fast. Especially if you have your key auto-repeat settings at like 50/sec with a short-ish delay like 220ms. You can also use control-s / control-r isearch within a one-liner, although that can take you back into other history. If you're good with control-w, alt+backspace, alt+d, and control-y, you can do a lot with just keyboard cursor movement.
Sep 30, 2019 at 16:03 comment added Anthony Geoghegan Upvoted though point 4 seems kind of pointless. :)
Sep 30, 2019 at 10:29 comment added cas I'm liking the answers i've seen so far. I especially like your 1st point - editing is one of the things I was planning to mention in my answer - even with ^X^E, it's much easier and far more pleasant to edit a script in your favourite editor than edit on the command-line.
Sep 30, 2019 at 10:22 history answered schaiba CC BY-SA 4.0