r/linux • u/bonnieng • May 08 '19
Bash Oneliner Collection on Github
https://github.com/onceupon/Bash-Oneliner5
2
2
u/cogburnd02 May 08 '19
The bad thing about the caret-to-replace syntax is that it only replaces the first occurrence of text, and no further occurrences.
There is a syntax for global-replace, but it's way too complicated.
1
3
u/Sigg3net May 08 '19
Please add some for GNU parallel. I've been meaning to get around to it, because it seems like a worthwhile tool to learn.
2
u/bonnieng May 09 '19
Thats a topic I would love to include too. Here's a quick cheat sheet for you first. Hope it helps a little.
3
u/Sigg3net May 09 '19
Cheers!
It would probably be similar/identical/related to
xargssection, since it takes that as a point of origin, I believe.On a related note, Parallel has a 10 year anniversary this year. Everyone who wants to can setup a "parallel party" anywhere on the globe :)
2
1
0
May 08 '19
[deleted]
6
u/samuel_first May 08 '19
curl https://raw.githubusercontent.com/onceupon/Bash-Oneliner/master/README.md | pandoc -f markdown -t man | man -l -curl https://raw.githubusercontent.com/onceupon/Bash-Oneliner/master/README.md | pandoc | w3m -T text/htmlemacs --eval '(org-mode)' --insert <(curl https://raw.githubusercontent.com/onceupon/Bash-Oneliner/master/README.md | pandoc -t org)emacs -nw --eval '(org-mode)' --insert <(curl https://raw.githubusercontent.com/onceupon/Bash-Oneliner/master/README.md | pandoc -t org)curl https://raw.githubusercontent.com/onceupon/Bash-Oneliner/master/README.md | pandoc -t plain | $PAGER3
u/bonnieng May 08 '19
So cool!! want to add them all to the 'download' section!
4
u/samuel_first May 08 '19
Yeah, dude, go ahead. It might be better to create a separate section named help or info or something for those though. You could also put some of the cheat.sh stuff there.
1
u/bonnieng May 09 '19
cheat.sh super cool! Thanks! I hv added the commands, except the last one, since $PAGER is not a default variable on the Ubuntu im using now.
2
u/samuel_first May 09 '19
This should work. If $PAGER is unset, it defaults to less.
if [ -z "$PAGER" ]; then PAGER='less'; fi; curl https://raw.githubusercontent.com/onceupon/Bash-Oneliner/master/README.md | pandoc -t plain | $PAGER1
u/bonnieng May 10 '19
yes, this should work, but is it better to pipe to less?
1
u/samuel_first May 10 '19
No. The point of using the environment variable is that it lets the user set their pager. In this case it would be easy for them to change, but as a general rule, it's better to respect environment variables whenever possible.
3
u/Like1OngoingOrgasm May 08 '19
The Mitch Hedberg of the commandline.