this post was submitted on 01 Dec 2024
406 points (99.0% liked)
Bash
763 readers
7 users here now
Talk about the Bash Shell and Bash scripting
founded 4 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
The most useful bash trick for me is to save what I learn in demonstration scripts so I can $cat it later for a syntax reminder.
ex :
file named : ./follow_jellyfin_system_log
contents :
#!/bin/bash
journalclt -fe -u jellyfin
(some time later) .. wtf args do i pass to journalctl again..
$ls ./script_parent_directory
(list of actions written in human language appear as file names)
$cat ./follow_jellyfin_system_log
me : "oh duh!"
rinse and repeat for every command or shortcut you learn, it forces you to convert the command into a short "noun_verb" format which to me is infinitely more understandable.
that's my workflow. then the meta is deciding how to store your scripts so you don't end up with a polluted home dir. godspeed fellow bashers.
For shorter, often used workflows i end up making an alias in bashrc/zshrc.
Tbh, I should consider migrating some of my one-liners to bash aliases. I just like to be cautious to not pollute my shell's auto-complete.
You can always start them off with an underscore ;)