hauntedpi
Posts: 2
Joined: Wed Feb 14, 2024 12:17 am

What is the best free bash scripting course?

Wed Feb 14, 2024 12:21 am

Hello, all. Just wanted to ask here if there is a really good bash scripting course free on YouTube or somewhere else? I really want to learn bash, but other tutorials did not help due to unreliable information. Thanks in advance!

User avatar
kerry_s
Posts: 7329
Joined: Thu Jan 30, 2020 7:14 pm

Re: What is the best free bash scripting course?

Wed Feb 14, 2024 2:55 am

google or chatgpt

ame
Posts: 8918
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: What is the best free bash scripting course?

Wed Feb 14, 2024 3:18 am

Oh no, not again.

hauntedpi
Posts: 2
Joined: Wed Feb 14, 2024 12:17 am

Re: What is the best free bash scripting course?

Wed Feb 14, 2024 9:21 pm

Thanks, ame! Will do :)

BigRedMailbox
Posts: 535
Joined: Sat Aug 20, 2022 10:37 pm

Re: What is the best free bash scripting course?

Wed Feb 14, 2024 9:55 pm

The best way to learn anything in computers is to have a task - a project.

Once you have that, learning the language (any language or any tool) is trivial. You just read the man pages and do lots and lots of trial and error. I've learned lots and lots of languages this way. But getting the project is the hard part.

And it is really funny - Despite having programmed in C for decades, I've always sort of wanted to learn C++, but never had a need to do it (i.e., a project). So, I never have. I guess it is just a function of the sorts of projects (tasks) that intrigue me.
My posts may be "controversial" and/or out-of-sync with the party line.

Nothing I write should in any way be taken as an official statement by any organization connected with (any branch of) RPi and/or any of its funding sources.

bls
Posts: 3661
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: What is the best free bash scripting course?

Wed Feb 14, 2024 10:08 pm

I agree with BigRedMailbox that the best way to learn a programming language, or pretty much anything computer-related, is to build a project. It doesn't need to be super-complex, but you'll learn how to find information on your chosen language, and you'll have the satisfaction of completing a project, perhaps enough satisfaction to then start a 2nd project, etc etc.

Also, everyone learns differently, so if someone recommended their favorite "course", you could very well find that the style doesn't click for you or the level of information provided is either insufficient or overwhelmingly boring.

IOW best is to spend quality time searching/researching on your own. At first you may need to spend more time than you'd like at it, but you can learn a tremendous amount this way about the technology/language/etc as well as the type of information that works best for you.
Pi tools:
Quickly and easily build customized exactly as-you-want SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure IPSEC/IKEV2 VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

tinker2much
Posts: 812
Joined: Wed Jun 20, 2018 12:38 am

Re: What is the best free bash scripting course?

Mon Feb 26, 2024 12:17 am

See "Writing Shell Scripts", by William E. Shotts, Jr.

https://www.linuxcommand.org/lc3_writin ... cripts.php
Contents

Writing Our First Script and Getting It to Work
Editing the Scripts We Already Have
Here Scripts
Variables
Command Substitution and Constants
Shell Functions
Some Real Work
Flow Control - Part 1
Stay Out of Trouble
Keyboard Input and Arithmetic
Flow Control - Part 2
Positional Parameters
Flow Control - Part 3
Errors and Signals and Traps (Oh My!) - Part 1
Errors and Signals and Traps (Oh My!) - Part 2
His "Resources" page is an education in itself: https://www.linuxcommand.org/lc3_resources.php
... as is his "Adventures" page: https://www.linuxcommand.org/lc3_adventures.php. Frankly, I would recommend any of his stuff!

User avatar
craigevil
Posts: 544
Joined: Wed Jan 27, 2021 5:22 am
Location: heaven

Re: What is the best free bash scripting course?

Mon Feb 26, 2024 2:23 am

The Advanced Bash-Scripting Guide
https://tldp.org/LDP/abs/html/

Description:
An in-depth exploration of the art of shell scripting.
.
This tutorial assumes no previous knowledge of scripting or
programming, but progresses rapidly toward an intermediate/advanced
level of instruction ... all the while sneaking in little snippets
of UNIX(R) wisdom and lore. It serves as a textbook, a manual for
self-study, and a reference and source of knowledge on shell
scripting techniques. The exercises and heavily-commented examples
invite active reader participation, under the premise that the only
way to really learn scripting is to write scripts.
.
This book is suitable for classroom use as a general introduction to
programming concepts.

It can also be installed

Code: Select all

sudo apt install abs-guide
There is also the Bash Guide for Beginners
https://tldp.org/LDP/Bash-Beginners-Gui ... index.html

If you want an actual course take a look at:
https://www.edx.org/
Raspberry PI 400 Raspberry Pi OS Bookworm Kernel: 6.6.22-v8+ DE: XFCE
Debian - "If you can't apt install something, it isn't useful or doesn't exist"

RaspISteve
Posts: 244
Joined: Wed Oct 24, 2012 9:15 pm
Location: Cheltenham, UK

Re: What is the best free bash scripting course?

Sat Mar 16, 2024 4:37 pm

HauntedPi,

Consider starting a little project using Bash scripting language that you have no idea how to proceed with. Break it down into little tasks and, by asking simple questions of Google, search the web for suggestions on how to do it.

I needed to organise all my digital pbotos, all in separate directories under a parent directory, and did so by wrapping a load of HTML around each file name and writing that to a file. Rather than writing the HTML directly I cobbled together a script which searched a directory for JPEG image file names. Then it was a matter of wrapping the necessary image file in the required HTML wrapper and appending it to a file with the previous stuff. By detecting directory names the script could call itself while also tracking where things were going and writing this in the HTML file. I also leant a lot about HTML.

Agreed, rather an off the wall solution but I got to explore the far corners of scripting as I tried to solve some of the daft situations I found myself in.

Perhaps the most critical two things is:

1: The first line of the script file : Bash scripts start with a 'shebang' ( #! ) followed by the path to the bash interpreter ( /bin/bash or /usr/bin/env bash ).

2: Understanding "chmod" enough to make your new script executable.

Followed by understanding how value or string can be assigned to a variable and how that new variable can be read by sticking a dollar symbol on the front of it. There are loads of pit-falls triggered by including spaces or indeed missing spaces to say nothing about how square and curved brackets opperate.

Maybe get a few pages/topics into a course then just have a go.

After this its just a list of command lines in a file that can be invoked as one command line whenever you need it.

Being a bit dyslexic I've always struggled following someone else's ideas on how to do something preferring to wing it as I go cross checking/referencing as I need.
Share and Enjoy.

Return to “General programming discussion”