public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Quico Jurado <quico.jurado@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Books about making shell scripts and other nifty commands.
Date: Tue, 10 Jun 2025 12:33:44 +0200	[thread overview]
Message-ID: <CANECUxpw7=pVjEUymTMFamKxMtBFvcVj6j1cVaeQS-2eX-aabQ@mail.gmail.com> (raw)
In-Reply-To: <e2b98860-96f3-a16f-d933-2a16353e91db@gmail.com>

Hello Dale,

The "Advanced Bash-Scripting Guide" (https://tldp.org/LDP/abs/html/)
has everything  you need to get up to speed with bash scripting and
it's full of examples for every concept explained in the guide.

On Tue, Jun 10, 2025 at 11:42 AM Dale <rdalek1967@gmail.com> wrote:
>
> Dale wrote:
> > Howdy,
> >
> > <<< SNIP >>>
> > So, I'm looking for a book, paperback would be nice but hardback is fine
> > too.  I found this.  I may look for a used version elsewhere too.
> > Reading what is described, this sounds like a good place to start.
> >
> > https://www.amazon.com/Super-Easy-Linux-Bash-Scripting/dp/B0F7GF439K
> >
> > <<< SNIP >>>
> >
> > Any thoughts on one I linked too?  Will that be OK for me to start out
> > with given my VERY basic skills?  Know of something better?  When I was
> > a kid, I was pretty good with BASIC on the old Commodore VIC-20 and 64.
> > That was a LONG time ago tho.
> >
> > Thanks.
> >
> > Dale
> >
> > :-)  :-)
> >
>
>
> I got the book in.  It's a good book for someone who is new to Linux.
> Maybe coming from Windows or something where commands are different.  It
> talks about a lot about common commands and such and does touch on
> scripts a bit.  Thing is, it isn't what I'm looking for.  I'm looking
> for how scripts work and how and why they are formatted and such.  I
> have questions like what does the "{" and "}" do?  How do I get it to
> check something and if one result matches it does A but if it is some
> other result it does B?  Example.

In the chapter 3 of the guide
(https://tldp.org/LDP/abs/html/special-chars.html) you'll find out
information about "{}". Then in chapter 7
(https://tldp.org/LDP/abs/html/testconstructs.html) you'll find
information about executing A or B using test constructs.

> I'm wanting to write a script that opens a encrypted drive and mounts
> the drive.  When I run the script, I first want it to check and see if
> it is still locked or not.  If it is still locked, ask for the
> passphrase and unlock.  If it is unlocked, then move to the next part
> for mounting.  If it is already mounted, then nothing is needed.  If it
> is not, mount the drive.  I'd also like it to print out what it is doing
> or not doing as well.  Back in the old basic days, we had "goto" and
> such.  I don't see that in bash type scripts.  Figure there is a way
> tho.  ;-)
>
> My question is this.  Do some of you have scripts that are fairly simple
> to figure out that does something similar to this that you can share?
> I'm wanting to check some scripts that are known to work and figure out
> how they work.  I tried to look at Frank's checksum script but that
> thing is HUGE.  I was lost before I even needed to scroll down.  Some
> fairly small and simple scripts may give me enough to figure out how to
> do what I want to do and understand it as well.  If someone has a script
> that is more like a example script, where the words used explain what
> the script is doing and why it is laid out a certain way, that would be
> really nice.
>
> The book is nice.  It's just not what I'm looking for.  I may try to
> find something cheap on Ebay.
>
> Thanks.
>
> Dale
>
> :-)  :-)
>

The guide is full of instructive examples, I'm pretty sure that you'll
find there most of the information that you need to write your script.

Cheers!


  reply	other threads:[~2025-06-10 10:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05  3:49 [gentoo-user] Books about making shell scripts and other nifty commands Dale
2025-06-05 15:32 ` Mark Knecht
2025-06-05 16:02   ` Eli Schwartz
2025-06-05 16:16     ` Mark Knecht
2025-06-05 17:19       ` Eli Schwartz
2025-06-06 14:14         ` [gentoo-user] " Nuno Silva
2025-06-05 16:59     ` [gentoo-user] " Dale
2025-06-05 17:44       ` eric
2025-06-05 19:50       ` Re[2]: " Stefan Schmiedl
2025-06-06  2:58         ` Dale
2025-06-05 17:03     ` Jay Faulkner
2025-06-05 17:56 ` yahoo
2025-06-05 18:48   ` Arve Barsnes
2025-06-05 19:05     ` Eli Schwartz
2025-06-08  0:09       ` [gentoo-user] " Nuno Silva
2025-06-05 18:33 ` [gentoo-user] " yahoo
2025-06-10  9:39 ` Dale
2025-06-10 10:33   ` Quico Jurado [this message]
2025-06-10 14:33   ` Mark Knecht
2025-06-10 15:01     ` Eli Schwartz
2025-06-10 16:24     ` yahoo
2025-06-10 18:12       ` Dale
2025-06-10 18:07     ` Dale
2025-06-10 18:18       ` Quico Jurado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANECUxpw7=pVjEUymTMFamKxMtBFvcVj6j1cVaeQS-2eX-aabQ@mail.gmail.com' \
    --to=quico.jurado@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox