Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When writing outside of a terminal, I wrap single-line shell commands with backslashes and space indentation. The breaks are at logical clauses, as if writing a conventional programming language. I find this much more readable than the alternatives. Often my terminal will also get it this way, from a copy-paste.

This also usually helps in documentation.



If I have to do it twice I stick it in a proper script, with some comments, so I remember what it all does next time I go to do it. I do this particularly for stuff like complex ffmpeg filter chains where I need to do a lot of stuff to a video file. By simply running the bash script, at some later date I can get it to remind me what it does, and suitably mangle the video file.

Then, later on, often weeks later, I use command history to scroll back through everything I've typed until I find something that looks vaguely like what I originally typed, or I don't find it and figure it all out from scratch again, having totally forgotten about the bash script I wrote.

I suspect this workflow is surprisingly common.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: