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
[–] [email protected] 12 points 3 days ago* (last edited 3 days ago) (1 children)

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.

[–] [email protected] 5 points 3 days ago (1 children)

For shorter, often used workflows i end up making an alias in bashrc/zshrc.

[–] [email protected] 4 points 3 days ago (1 children)

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.

[–] [email protected] 1 points 2 days ago

You can always start them off with an underscore ;)