LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-28-2018, 01:03 PM   #1
GPGAgent
Member
 
Registered: Oct 2018
Location: Cornwall UK
Distribution: Mint 20 xfce 64bit
Posts: 949
Blog Entries: 3

Rep: Reputation: 129Reputation: 129
Bash scripting resources - books, websites, tutorials, standards etc


Hi All,

Can I get some recommendations to learn Bash scripting? Books, tutorials, tips & tricks, etc.

Also some idea on good practice, standards, and so on.

One tip I read was that ending scripts with .sh is bad form. Not sure why this would be.

TIA folks

Last edited by GPGAgent; 11-28-2018 at 05:06 PM.
 
Old 11-28-2018, 01:13 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,589

Rep: Reputation: 2184Reputation: 2184Reputation: 2184Reputation: 2184Reputation: 2184Reputation: 2184Reputation: 2184Reputation: 2184Reputation: 2184Reputation: 2184Reputation: 2184
Not bash so much, but I started with O'Reilly's "UNIX in a Nutshell" back in the day.
There is a lot of good information on the 'net. DuckDuckGo is your friend.
 
2 members found this post helpful.
Old 11-28-2018, 01:37 PM   #3
nodir
Member
 
Registered: May 2016
Posts: 222

Rep: Reputation: Disabled
Quote:
On tip I read was that ending scripts with .sh is bad form. Not sure why this would be.
This is what the #bash IRC channel bot says about it:
Quote:
Don't use extensions for your scripts. Scripts define new commands that you can run, and commands are generally not given extensions. Do you run ls.elf? Also: bash scripts are *not* sh scripts (so don't use .sh) and the extension will only cause dependencies headaches if the script gets rewritten in another language. See
http://www.talisman.org/~erlkonig/do...idered-harmful
Idling in that channel, #bash, will teach you quite a bit (or at least it helped me, but i got rather basic needs).

If you (think you must) use the web, as proposed, then you will probably make sure to compare the results with this:
http://mywiki.wooledge.org/BashPitfalls
lots of times you will run into one of these pitfalls when searching the web.
The "guide" and the "FAQ" at that site, mywiki.wooledge.org, are also pretty good.
Else there is: http://wiki.bash-hackers.org/ as a good guide.

And also you might want to make use of:
https://www.shellcheck.net/
 
2 members found this post helpful.
Old 11-28-2018, 02:09 PM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 19,916

Rep: Reputation: 6743Reputation: 6743Reputation: 6743Reputation: 6743Reputation: 6743Reputation: 6743Reputation: 6743Reputation: 6743Reputation: 6743Reputation: 6743Reputation: 6743
tldp was not yet mentioned:
http://tldp.org/LDP/Bash-Beginners-Guide/html/
http://wiki.tldp.org/Bash-Prog-Intro-HOWTO
http://tldp.org/LDP/abs/html/

They are old, but not outdated. The newest "inventions" are missing, otherwise a really good resource.
 
3 members found this post helpful.
Old 11-28-2018, 05:07 PM   #5
GPGAgent
Member
 
Registered: Oct 2018
Location: Cornwall UK
Distribution: Mint 20 xfce 64bit
Posts: 949

Original Poster
Blog Entries: 3

Rep: Reputation: 129Reputation: 129
Thanks for the comments, and of course I forgot the main resource - linuxquestions.org!
 
Old 11-29-2018, 04:57 AM   #6
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 900

Rep: Reputation: 289Reputation: 289Reputation: 289
2 more:
 
2 members found this post helpful.
Old 11-29-2018, 01:08 PM   #7
GPGAgent
Member
 
Registered: Oct 2018
Location: Cornwall UK
Distribution: Mint 20 xfce 64bit
Posts: 949

Original Poster
Blog Entries: 3

Rep: Reputation: 129Reputation: 129
Just found these https://google.github.io/styleguide/shell.xml

http://www.nws.noaa.gov/oh/hrl/devel..._Standards.pdf

http://teaching.idallen.com/cst8177/...ipt_style.html

http://www.inquisitor.ru/doc/coding-style-shell.html
 
1 members found this post helpful.
Old 11-29-2018, 02:20 PM   #8
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,039
Blog Entries: 23

Rep: Reputation: 3990Reputation: 3990Reputation: 3990Reputation: 3990Reputation: 3990Reputation: 3990Reputation: 3990Reputation: 3990Reputation: 3990Reputation: 3990Reputation: 3990
While it is not in a How-To or Tips-n-Tricks format, do not neglect the bash man page!

It is complete, readable and always available (if not on your distro then change distros!).

I find many people shun the bash man page because of its length - it is long because it contains a wealth of information!

Spend some quality time learning your way around it, the effort will repay you many times over!
 
3 members found this post helpful.
Old 11-30-2018, 09:13 AM   #9
GPGAgent
Member
 
Registered: Oct 2018
Location: Cornwall UK
Distribution: Mint 20 xfce 64bit
Posts: 949

Original Poster
Blog Entries: 3

Rep: Reputation: 129Reputation: 129
Good point about man pages

And of course for internal commands there is help

help will list all built in commands

and then help cmdname will print help about cmdname

Code:
onk@XEON4 ~ $ help bg
bg: bg [job_spec ...]
    Move jobs to the background.
    
    Place the jobs identified by each JOB_SPEC in the background, as if they
    had been started with `&'.  If JOB_SPEC is not present, the shell's notion
    of the current job is used.
    
    Exit Status:
    Returns success unless job control is not enabled or an error occurs.
jonk@XEON4 ~ $
- cheers
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Learning Linux with Slackware and Ubuntu. What books, websites, etc. are recommended? bfamily Linux - Newbie 8 01-11-2010 08:41 AM
LXer: On standards and standards bodies LXer Syndicated Linux News 0 09-04-2008 08:00 AM
LXer: OOXML: Standards for accepting standards LXer Syndicated Linux News 0 03-13-2008 12:40 AM
LXer: The Free Standards Group: Squaring the Open Source/Open Standards Circle LXer Syndicated Linux News 0 05-30-2006 05:21 AM
looking for programming tutorials / books, etc markus1982 Programming 18 03-12-2003 04:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration