A collection of handy Bash One-Liners and terminal tricks for data processing and Linux system maintenance.
Ctrl + x + Ctrl + e : launch editor defined by $EDITOR to input your command. Useful for multi-line commands.
I have tested this on windows with a MINGW64 bash, it works similarly to how `git commit` works; by creating a new temporary file and detecting* when you close the editor.
* Actually I have no idea how this works; does bash wait for the child process to stop? does it do some posix filesystem magic to detect when the file is "free"? I can't really see other ways
ShellCheck, a static analysis tool for shell scripts
I'm being flippant, because shell scripts are so inherently error prone they're to be avoided for critical stuff like this.
If you _absolutely_ must use a shell script:
0. Use shellcheck, which will warn you about many of the below issues: https://www.shellcheck.net/
1. understand how quoting and word splitting work: https://mywiki.wooledge.org/Quotes
2. if piping files to other programs, using `-print0` or equivalent (or even better, if using something like find, its built in execution options): https://mywiki.wooledge.org/UsingFind
3. Beware the pitfalls (especially something like parsing `ls`): https://mywiki.wooledge.org/BashPitfalls
(warning: the community around that wiki can be pretty toxic, just keep that in mind when foraying into it.)
Collect and Analyze Billions of Data Points in Real Time. Manage all types of time series data in a single, purpose-built database. Run at any scale in any environment in the cloud, on-premises, or at the edge.
Ask HN: How does one practice day to day shell scripting
2 projects | news.ycombinator.com | 23 Sep 2023
ShellCheck: Static analysis tool for shell scripts
1 project | news.ycombinator.com | 31 Aug 2023
How to verify if a redis dump was successfully restored?
1 project | /r/bash | 16 Aug 2023
MS Teams channels cannot contain MS-DOS device names
1 project | news.ycombinator.com | 10 Aug 2023
Is it normal for bash to be extremely difficult or is it just me
1 project | /r/bash | 22 Jun 2023