Author Topic: Best of Bash Links  (Read 3745 times)

statmonkey

  • Posts: 330
    • View Profile
Best of Bash Links
« on: September 29, 2013, 07:53:05 PM »
I hold bash in the highest regard.  I more than love it I luuuurrrrvvvee it.  I was thinking that with all bash can do we should probably have a little go to of places to get more on bash.  There really is so much there I don't think anyone could know it all.  I have one page in particular that I refer to fairly often and thought I would post it and perhaps others will find it useful or can add to the list.

http://samrowe.com/wordpress/advancing-in-the-bash-shell/

If you are interested in doing more with bash.  I highly recommend this short read.  Tons of good stuff in there I frequently forget.

valroadie

  • Posts: 53
    • View Profile
Re: Best of Bash Links
« Reply #1 on: September 29, 2013, 11:10:05 PM »
Awesome that you started this statmonkey as I am learning BASH as of this moment! :D

Hopefully I can put some things in here when I get a bit more advanced in my learning.

statmonkey

  • Posts: 330
    • View Profile
Re: Best of Bash Links
« Reply #2 on: September 30, 2013, 03:14:00 AM »
Great valroadie, it's a wonderful journey. I have often thought that they should have called it base instead of bash because really it is a base of knowledge that is applicable in just about every area of computing.  Understand bash and you will understand most of what happens on your box. 

Don't wait until you think you are more advanced to post, one of the problems of using something daily (like bash which I use every minute I am on the box) is that you forget how much you know.  Meaning that someone starting out often "knows" more than some of us who use it all the time. 

Even worse, what has become second nature for us we have forgotten that not everyone uses all the time.  I was reminded of this today when helping a friend of mine and I started using cdargs (http://www.linux.com/learn/tutorials/332972-cdargs-brings-bookmarks-to-the-linux-command-line and she kept saying how did you do that, what was that.  I started explaining the process I was going through and she said no not that, she was taking about how I was jumping around in my bash environment.  So when you see something you think is really cool, or that you didn't know you could do post in here, it will undoubtedly help someone else.

One last thought.  To my mind the greatest part of bash learning is that it can be acquired on an as needed basis.  You learn a little to do what you want to and then can move on to something else that you want to do.  There is not any required order to speak of.  It is like a book that always opens to the page you need.

sqlpython

  • Posts: 70
    • View Profile
Re: Best of Bash Links
« Reply #3 on: September 30, 2013, 04:04:52 AM »
Quote
One last thought.  To my mind the greatest part of bash learning is that it can be acquired on an as needed basis.  You learn a little to do what you want to and then can move on to something else that you want to do.  There is not any required order to speak of.  It is like a book that always opens to the page you need.

   Yes, that is a very important point. I have bash scripts that I have usefully created as needed over the last twenty years and none of each is much like the other. I went about creating each one for a particular need. While I never learned BASH, as pointed out, from A-z like Java or python each creation was easy to code with resources available. Great tool..
   
    In later years I attempted to replace some BASH scripts with Python or Java or even C but as BASH scripts are usually short and to the point the exercise of switching code was not fruitful...
Stretch, Siduction-15.1,  Slackware 14.1, LMDE, Calculate 15.7

tlinsley

  • Posts: 47
    • View Profile
Re: Best of Bash Links
« Reply #4 on: September 30, 2013, 04:07:30 AM »
After recovering from an unfortunate (read self-inflicted) bookmark meltdown (FF sync and Xmark butted heads, don't ask), I offer a few bash links.

Hope someone finds them useful.   :)

Bash Hackers Wiki Frontpage

Bash Reference Manual

Heiner's SHELLdorado

R2's Shell Tutorials

The Linux Cookbook: Tips and Techniques for Everyday Use

Greg's Wiki

Some Bash Script Exercises…

Simple howtos

Unix Toolbox

A Unix/Linux “find” Command Tutorial

statmonkey

  • Posts: 330
    • View Profile
Re: Best of Bash Links
« Reply #5 on: September 30, 2013, 04:20:18 AM »
tlinsley - great list and many I was unfamiliar with.  I realized most of my links are pretty old like http://www.caliban.org/bash/#completion but still useful.  I thank you, old dog here needing new tricks and this will fill my break time for the next few weeks reading through your links.  Thank you.

One more quick one that I hardly ever see discussed (will probably be in every one of your links but ... oh well).
Code: [Select]
bash -vrunning this will give you a scrollable run through of your bash environment and settings printing out your system .bashrc, aliases and user files in one rather lengthy screen.  I find it very useful for those "senior" moments when something isn't working as I expect or I can't remember a setting.

sqlpython - too true.  I do use python, ruby on occasion, never java, never C but find that in the end bash really meets most of my needs on the box (not counting heavier lifting here). I also thought when I wrote the stuff in bash that I was sure that there were more efficient ways to do things and that I was a child for using bash.  Usually I do find that those earlier scripts were inefficient (I am not really a very good scripter) and that there are better ways to do what I want.  Almost always those ways turn out to be -- wait for it --- more sophisticated ways using bash!  It's like the old story of the guy who tells his old friends good bye because he is being introduced to the "in" crowd of up and comers and then when he goes to meet the up and comers is introduced to all his old friends.

tlinsley

  • Posts: 47
    • View Profile
Re: Best of Bash Links
« Reply #6 on: September 30, 2013, 04:36:14 AM »
@statmonkey - Lol.  It's a small world (internet).  I was just on that page recently, learning about cdpath.  That "bash -v" is interesting, don't recall using it before.  But now that I have seen the output, I will be compelled to cleanup my crufty environment darn-it.

sqlpython

  • Posts: 70
    • View Profile
Re: Best of Bash Links
« Reply #7 on: October 02, 2013, 04:12:21 PM »
Didn't see this one listed

http://snipplr.com/all/language/bash
Stretch, Siduction-15.1,  Slackware 14.1, LMDE, Calculate 15.7

sqlpython

  • Posts: 70
    • View Profile
Re: Best of Bash Links
« Reply #8 on: October 02, 2013, 05:16:46 PM »
 I dragged this over from a #! post that I made a couple of years ago.
A bash script to display the weather in  a pop up terminal display. Tiling guys will like this one. Seems apropos for Flux and OB also.
Basically a one liner that utilizes the weather-util package to display a StationID and results.
You could incorporate Zenity as well if you want an X look about it.
I for instance don't have a weather app installed in Sid nor the liquid icon listed in could. So I replaced it with the Cloud icon from my Dreampie..
Just save it and make it executable. Then you can make a launcher icon or just type it to launch it. Perhaps Cron it for particular times.
Code: [Select]
#!/bin/bash
xfce4-terminal -I "/usr/share/xfce4/weather/icons/liquid/30.png" --geometry 65x9 -T "Weather Report" -H -e "weather-util -c NYC -s NY -i KNYC"
Stretch, Siduction-15.1,  Slackware 14.1, LMDE, Calculate 15.7

statmonkey

  • Posts: 330
    • View Profile
Re: Best of Bash Links
« Reply #9 on: October 02, 2013, 06:52:27 PM »
Ooooh new toys ... Snipplr is pretty cool - I had not seen that before.  It reminds me there was another like it, sort of designed like a terminal? Bashfu? http://www.commandlinefu.com/commands/browseNo, but something like that. Thanks for sparking my memory.  I learned some good stuff on that site.

It sucks to get old. Thanks sqlpython snipplr will be something I will look at daily. 

That weather thing I will have to play with.  For one I use terminator so I can't use -I ...  As for using it with cron I could see that I could also see a way you could use it with "incron" if anybody uses it.  I love incron.

Digit

  • Techno Hippie
  • Posts: 295
  • savant (alegedly), polymath (wannabe)
    • View Profile
    • wastedartist.com
Re: Best of Bash Links
« Reply #10 on: October 04, 2013, 06:01:27 PM »
alas, i wish i could contribute something more specific to this thread, but really, when i'm off learning new bash tricks these days, it tends to just be a rtfg.net as per need.  not a lot of pure-curiosity stuff [(~ <- tinsly's bash links list (a few posts back )is well suited for ~)], which is a pity as i'm sure there's loads more wonders to it than i currently slowly drill into.

re: functions,
yep.  really awesome.  though i tend to wrap up stuff in their own executable scripts in ~/bin, and then just run them (or alias that script to something punchy in .bashrc ~ like in cases where i have several similar scripts, but only want the one, and keep an alias for the best of whatever, so i just change what the alias points to when i add a better script).

i try to keep my bashrc reasonably short n clean...  past ones have bloated to unmanageable sizes.  scripts > functions > aliases.  with scripts you can have lots of functions.   though, there is something to be said for having all your gems in the one .bashrc file that you take with you, rather than lugging around your whole ~/bin everywhere.

a thread for functions.   i say, good idea.  go for it.  :)

tlinsley

  • Posts: 47
    • View Profile
Re: Best of Bash Links
« Reply #11 on: October 05, 2013, 05:05:55 AM »

statmonkey

  • Posts: 330
    • View Profile
Re: Best of Bash Links
« Reply #12 on: October 05, 2013, 07:27:34 PM »
Hey Digit could you move my post above to a new thread on functions?  I will then add some stuff in there.  I went through the same thing, at one point my .bashrc was about a mile long.  There are some things though (certain functions and the completion stuff) that I keep in it as essential.  I have a project that I have to finish today and will add some more bash links to this post a little later today (I hope)

Digit

  • Techno Hippie
  • Posts: 295
  • savant (alegedly), polymath (wannabe)
    • View Profile
    • wastedartist.com
Re: Best of Bash Links
« Reply #13 on: October 10, 2013, 10:54:42 AM »
Hey Digit could you move my post above to a new thread on functions?  I will then add some stuff in there.  I went through the same thing, at one point my .bashrc was about a mile long.  There are some things though (certain functions and the completion stuff) that I keep in it as essential.  I have a project that I have to finish today and will add some more bash links to this post a little later today (I hope)

:) done