public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Books about making shell scripts and other nifty commands.
@ 2025-06-05  3:49 Dale
  2025-06-05 15:32 ` Mark Knecht
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Dale @ 2025-06-05  3:49 UTC (permalink / raw
  To: gentoo-user

Howdy,

As most know, I have very basic script skills.  Most of you wouldn't
even call my stuff scripts most likely.  I'm not sure if they meet the
definition either.  I have quite a few "scripts" that I use to do all
sorts of things.  I use scripts to unlock and mount encrypted drive
sets, update backups and all that sort of thing.  I'd like to add some
things to my little scripts but don't know how.  I know it can be done
tho.  Example.  I'd like to add a section that when I run a script to
unlock and mount a drive set, I'd like it to check and make sure it
isn't already open and/or mounted.  If it is not one or both of those
things, then do whichever one, or both, that are not already done.  For
my backup scripts, I'd like to add a section that makes sure the drive
set for the backup is unlocked and mounted first.  If not, print out
that it is not mounted and stop.  I wouldn't mind learning some other
stuff to.  I just want to keep the cost down a bit, used is also a
option if in real good shape.  I also don't want to buy a book that
doesn't have what I need. 

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

I figure that several people on this list have had or used books from a
library or something and knows of some books that start out really
simple.  I need simple.  I also want something that is mostly about
scripting but if it has some other info, that is good too.  Might come
in handy one day.  I would also like the book to be fairly up to date.

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

:-)  :-) 

P. S.  Got all my data moved around like I wanted.  Now I have 4 extra
drives.  One 20TB, 2 14TBs and a 10TB.  A little over 50TBs total.  :-D 
Also, everything I wanted to be encrypted, is now encrypted. 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  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 17:56 ` yahoo
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 24+ messages in thread
From: Mark Knecht @ 2025-06-05 15:32 UTC (permalink / raw
  To: gentoo-user

On Wed, Jun 4, 2025 at 8:50 PM Dale <rdalek1967@gmail.com> wrote:
>
> Howdy,
>
> As most know, I have very basic script skills.  Most of you wouldn't
> even call my stuff scripts most likely.  I'm not sure if they meet the
> definition either.  I have quite a few "scripts" that I use to do all
> sorts of things.  I use scripts to unlock and mount encrypted drive
> sets, update backups and all that sort of thing.  I'd like to add some
> things to my little scripts but don't know how.  I know it can be done
> tho.  Example.  I'd like to add a section that when I run a script to
> unlock and mount a drive set, I'd like it to check and make sure it
> isn't already open and/or mounted.  If it is not one or both of those
> things, then do whichever one, or both, that are not already done.  For
> my backup scripts, I'd like to add a section that makes sure the drive
> set for the backup is unlocked and mounted first.  If not, print out
> that it is not mounted and stop.  I wouldn't mind learning some other
> stuff to.  I just want to keep the cost down a bit, used is also a
> option if in real good shape.  I also don't want to buy a book that
> doesn't have what I need.
>
> 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
>
> I figure that several people on this list have had or used books from a
> library or something and knows of some books that start out really
> simple.  I need simple.  I also want something that is mostly about
> scripting but if it has some other info, that is good too.  Might come
> in handy one day.  I would also like the book to be fairly up to date.
>
> 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.

<SNIP>

A book is one way to go, especially if someone trusted recommends
the title.

As for me - and this isn't bash scripting - but I've learned Python just
using videos on YouTube coupled with asking AI Helpers {Chat GTP,
Gemini, Claude, Deepseek, Copilot} either questions I want answered
or, more importantly, providing it with some code I wrote and asking it
two basic questions:

1) What does this code do?

2) Are there any problems this code might cause or side effects I
should be aware of?

Those two questions plus a copy of my real data I want to work on
so that it doesn't make a mistake and delete or corrupt my real data
have allowed me to make a lot of progress without spending a
penny. I suspect this would work well for you if it suits your learning
style.

I see plenty of videos on YouTube about bash scripting.

All of the AI helpers will answer 20-30 questions a day for free so
there's no cost involved, and you can ask each of them the same
questions to get multiple points of view on solving your problems.

As an example, here's a simple request I made of Copilot:

<QUOTE>
I would like to ask a question about bash scripting in Linux. Assume I
have a disk system I want to mount. Can we write a bash script that
will 1) Check to see if the disk is already mounted. If it is report
that back in the terminal and take no more action 2) If the disk is
not mounted, attempt to mount the disk using information in /etc/fstab
3) Report back whether the disk mounted successfully or not.
</QUOTE>

<ANSWER>
Absolutely! Here's a Bash script that accomplishes all three tasks. It
checks whether the disk is mounted, attempts to mount it if necessary,
and then reports the result.




bash

#!/bin/bash

# Define the mount point
MOUNT_POINT="/mnt/mydisk"

# Check if the disk is already mounted
if mountpoint -q "$MOUNT_POINT"; then
    echo "The disk is already mounted at $MOUNT_POINT."
    exit 0
fi

# Attempt to mount the disk using /etc/fstab
echo "Mounting the disk..."
mount "$MOUNT_POINT"

# Check if the mount was successful
if mountpoint -q "$MOUNT_POINT"; then
    echo "Mount successful!"
    exit 0
else
    echo "Mount failed. Please check /etc/fstab and system logs."
    exit 1
fi

Explanation:

mountpoint -q "$MOUNT_POINT": Checks if the directory is a mounted file system.

mount "$MOUNT_POINT": Attempts to mount the disk based on the /etc/fstab entry.

Second mountpoint -q "$MOUNT_POINT": Verifies whether the mount was successful.

Notes:

Ensure that /etc/fstab has a correct entry for the disk and mount point.

Run this script with sufficient privileges (e.g., sudo ./script.sh).

Modify $MOUNT_POINT to match your actual mount directory.

Would you like any refinements or additional functionality?




Hope this helps,
Mark


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-05 15:32 ` Mark Knecht
@ 2025-06-05 16:02   ` Eli Schwartz
  2025-06-05 16:16     ` Mark Knecht
                       ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Eli Schwartz @ 2025-06-05 16:02 UTC (permalink / raw
  To: gentoo-user


[-- Attachment #1.1: Type: text/plain, Size: 2535 bytes --]

On 6/5/25 11:32 AM, Mark Knecht wrote:
> A book is one way to go, especially if someone trusted recommends
> the title.
> 
> As for me - and this isn't bash scripting - but I've learned Python just
> using videos on YouTube coupled with asking AI Helpers {Chat GTP,
> Gemini, Claude, Deepseek, Copilot} either questions I want answered
> or, more importantly, providing it with some code I wrote and asking it
> two basic questions:
> 
> 1) What does this code do?
> 
> 2) Are there any problems this code might cause or side effects I
> should be aware of?
> 
> Those two questions plus a copy of my real data I want to work on
> so that it doesn't make a mistake and delete or corrupt my real data
> have allowed me to make a lot of progress without spending a
> penny. I suspect this would work well for you if it suits your learning
> style.
> 
> I see plenty of videos on YouTube about bash scripting.
> 
> All of the AI helpers will answer 20-30 questions a day for free so
> there's no cost involved, and you can ask each of them the same
> questions to get multiple points of view on solving your problems.


Artificial non-intelligence is based on a sophisticated
https://en.wikipedia.org/wiki/Mad_Libs generator. It is a program
designed to produce pseudorandom output streams with a weight towards
grammatically correct output.

It possesses no knowledge or reasoning and literally *cannot* possess
the attribute of being correct. It is very good at superficially looking
correct. Whether or not it actually is correct is up to a roll of the dice.

Any knowledgeable AI user will tell you: AI *cannot* be safely used
unless you already know what you are doing and can review the results
before running it. AI proponents find AI useful to reduce the manual
labor involved in writing the script -- ***not*** for figuring out the
correct thing to do. This is an iterative process of rejecting answers
that look wrong and tweaking the prompt, getting the AI to try again and
again until it gets the right answer.

DO NOT USE AI AS A TEACHER. YOU WILL BREAK YOUR SYSTEM IRREPARABLY.

You will delete all your data by accident.

You will be the latest example of a foolish fool posting on Reddit in
tears, asking if there is any way to recover years worth of labor that
wasn't backed up properly.

You will learn nothing, or you will learn how to write incorrect and
buggy scripts because you aren't able to evaluate which answers are
hallucinations.


-- 
Eli Schwartz

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-05 16:02   ` Eli Schwartz
@ 2025-06-05 16:16     ` Mark Knecht
  2025-06-05 17:19       ` Eli Schwartz
  2025-06-05 16:59     ` [gentoo-user] " Dale
  2025-06-05 17:03     ` Jay Faulkner
  2 siblings, 1 reply; 24+ messages in thread
From: Mark Knecht @ 2025-06-05 16:16 UTC (permalink / raw
  To: gentoo-user

On Thu, Jun 5, 2025 at 9:03 AM Eli Schwartz <eschwartz@gentoo.org> wrote:
>
> On 6/5/25 11:32 AM, Mark Knecht wrote:
> > A book is one way to go, especially if someone trusted recommends
> > the title.
> >
> > As for me - and this isn't bash scripting - but I've learned Python just
> > using videos on YouTube coupled with asking AI Helpers {Chat GTP,
> > Gemini, Claude, Deepseek, Copilot} either questions I want answered
> > or, more importantly, providing it with some code I wrote and asking it
> > two basic questions:
> >
> > 1) What does this code do?
> >
> > 2) Are there any problems this code might cause or side effects I
> > should be aware of?
> >
> > Those two questions plus a copy of my real data I want to work on
> > so that it doesn't make a mistake and delete or corrupt my real data
> > have allowed me to make a lot of progress without spending a
> > penny. I suspect this would work well for you if it suits your learning
> > style.
> >
> > I see plenty of videos on YouTube about bash scripting.
> >
> > All of the AI helpers will answer 20-30 questions a day for free so
> > there's no cost involved, and you can ask each of them the same
> > questions to get multiple points of view on solving your problems.
>
>
> Artificial non-intelligence is based on a sophisticated
> https://en.wikipedia.org/wiki/Mad_Libs generator. It is a program
> designed to produce pseudorandom output streams with a weight towards
> grammatically correct output.
>
> It possesses no knowledge or reasoning and literally *cannot* possess
> the attribute of being correct. It is very good at superficially looking
> correct. Whether or not it actually is correct is up to a roll of the dice.
>
> Any knowledgeable AI user will tell you: AI *cannot* be safely used
> unless you already know what you are doing and can review the results
> before running it. AI proponents find AI useful to reduce the manual
> labor involved in writing the script -- ***not*** for figuring out the
> correct thing to do. This is an iterative process of rejecting answers
> that look wrong and tweaking the prompt, getting the AI to try again and
> again until it gets the right answer.
>
> DO NOT USE AI AS A TEACHER. YOU WILL BREAK YOUR SYSTEM IRREPARABLY.
>
> You will delete all your data by accident.
>
> You will be the latest example of a foolish fool posting on Reddit in
> tears, asking if there is any way to recover years worth of labor that
> wasn't backed up properly.
>
> You will learn nothing, or you will learn how to write incorrect and
> buggy scripts because you aren't able to evaluate which answers are
> hallucinations.
>
>
> --
> Eli Schwartz

<hehe>

I sense a certain overriding fear about the future...

</hehe>

As I said, lots of videos on YouTube supplemented by AI and tested
on copies of data or test machines. Additionally I did give some
guidance on how Dale might, if he was to use these tools, double
check the results before committing a grievous error on his
hardware. He could ask other AI's that did not produce the code in
question what it does. He could post it here for comments and
improvements.

Running scared is, to me, silly. Dale wants to learn. That's great
and these tools are one way to approach the problem. I'm using
them successfully every day of the week. Once I learned how to
ask questions correctly I found they don't hallucinate much, at
least with Python coding. I have built my own AI's for recognizing
playing cards. No way would I have made this progress without
the help I got from these tools.

Purchasing a book is a great thing to do, as I said before, if it is
recommended by someone trusted. (Or if you have money to
burn and shelf space for collecting dust after the 2 hours you use
it.)

To each his own. I agree with you in general - don't trust AI with
anything important. If you prefer then 'trust but verify'.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-05 16:02   ` Eli Schwartz
  2025-06-05 16:16     ` Mark Knecht
@ 2025-06-05 16:59     ` Dale
  2025-06-05 17:44       ` eric
  2025-06-05 19:50       ` Re[2]: " Stefan Schmiedl
  2025-06-05 17:03     ` Jay Faulkner
  2 siblings, 2 replies; 24+ messages in thread
From: Dale @ 2025-06-05 16:59 UTC (permalink / raw
  To: gentoo-user

Eli Schwartz wrote:
> On 6/5/25 11:32 AM, Mark Knecht wrote:
>> A book is one way to go, especially if someone trusted recommends
>> the title.
>>
>> As for me - and this isn't bash scripting - but I've learned Python just
>> using videos on YouTube coupled with asking AI Helpers {Chat GTP,
>> Gemini, Claude, Deepseek, Copilot} either questions I want answered
>> or, more importantly, providing it with some code I wrote and asking it
>> two basic questions:
>>
>> 1) What does this code do?
>>
>> 2) Are there any problems this code might cause or side effects I
>> should be aware of?
>>
>> Those two questions plus a copy of my real data I want to work on
>> so that it doesn't make a mistake and delete or corrupt my real data
>> have allowed me to make a lot of progress without spending a
>> penny. I suspect this would work well for you if it suits your learning
>> style.
>>
>> I see plenty of videos on YouTube about bash scripting.
>>
>> All of the AI helpers will answer 20-30 questions a day for free so
>> there's no cost involved, and you can ask each of them the same
>> questions to get multiple points of view on solving your problems.
>
> Artificial non-intelligence is based on a sophisticated
> https://en.wikipedia.org/wiki/Mad_Libs generator. It is a program
> designed to produce pseudorandom output streams with a weight towards
> grammatically correct output.
>
> It possesses no knowledge or reasoning and literally *cannot* possess
> the attribute of being correct. It is very good at superficially looking
> correct. Whether or not it actually is correct is up to a roll of the dice.
>
> Any knowledgeable AI user will tell you: AI *cannot* be safely used
> unless you already know what you are doing and can review the results
> before running it. AI proponents find AI useful to reduce the manual
> labor involved in writing the script -- ***not*** for figuring out the
> correct thing to do. This is an iterative process of rejecting answers
> that look wrong and tweaking the prompt, getting the AI to try again and
> again until it gets the right answer.
>
> DO NOT USE AI AS A TEACHER. YOU WILL BREAK YOUR SYSTEM IRREPARABLY.
>
> You will delete all your data by accident.
>
> You will be the latest example of a foolish fool posting on Reddit in
> tears, asking if there is any way to recover years worth of labor that
> wasn't backed up properly.
>
> You will learn nothing, or you will learn how to write incorrect and
> buggy scripts because you aren't able to evaluate which answers are
> hallucinations.
>
>


I'm not big on the AI thing yet either.  Reminds me of that movie
Terminator and a few others.  I'm not real sure about us going down that
road myself. 

One thing I like about the book I linked to, it is new.  It should be
good for all the new versions of software.  The bad thing about being
new, no one has wrote a review on it yet.  I was hoping someone here
might have bought a copy or knew someone who did.  I think I'll risk it
and just buy the thing.  I'm not looking to create a new distro or
anything so it should hopefully be good enough, if I can understand what
it is saying. 

Like that command mountpoint.  I was wondering how one can check if
something is mounted or not.  No idea that existed.  o_O 

I'll post back when it comes in and I get a chance to read it.  If I can
figure out what it is saying, it should be good for almost anyone.  :-D

Thanks. 

Dale

:-)  :-) 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-05 16:02   ` Eli Schwartz
  2025-06-05 16:16     ` Mark Knecht
  2025-06-05 16:59     ` [gentoo-user] " Dale
@ 2025-06-05 17:03     ` Jay Faulkner
  2 siblings, 0 replies; 24+ messages in thread
From: Jay Faulkner @ 2025-06-05 17:03 UTC (permalink / raw
  To: gentoo-user

On 6/5/2025 9:02 AM, Eli Schwartz wrote:
> Any knowledgeable AI user will tell you: AI*cannot* be safely used
> unless you already know what you are doing and can review the results
> before running it.

I use LLM-based tooling frequently in my job, and this really is the 
key. You have to be able to detect when something looks plausible but 
may not work. Even worse, using it as a learning tool, you may not be 
learning the conventions folks generally abide when using these. In my 
experience; even when prompted well (which requires domain knowledge in 
the topic you're prompting about) it gets things right about 70%-80% of 
the time -- and some of those are sneaky hard to find unless you know 
what to look for.

That doesn't mean it's useless -- far from it -- but it does mean you 
probably shouldn't be using it as a primary source to learn from. At 
least in it's current form.

-JayF


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-05 16:16     ` Mark Knecht
@ 2025-06-05 17:19       ` Eli Schwartz
  2025-06-06 14:14         ` [gentoo-user] " Nuno Silva
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Schwartz @ 2025-06-05 17:19 UTC (permalink / raw
  To: gentoo-user


[-- Attachment #1.1: Type: text/plain, Size: 959 bytes --]

On 6/5/25 12:16 PM, Mark Knecht wrote:
> <hehe>
> 
> I sense a certain overriding fear about the future...
> 
> </hehe>


I'm not worried about the future, I'm worried about today, and today's
users seeking help and getting led astray.


> To each his own. I agree with you in general - don't trust AI with
> anything important. If you prefer then 'trust but verify'.


I don't consider AI to provide value enhancement for me at all, for much
the same reason as described at

https://infosec.exchange/@david_chisnall/113690087142854474

It saves time on writing code. It costs *more* time in debugging subtle
edge cases. This is a steep disadvantage for a technology that is full
of questions about legal liability!

Of course, your mileage may vary... if it's only for personal use you
may not care about legal liability, and if you couldn't write it
yourself at all then maybe the debugging is worth it.



-- 
Eli Schwartz

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-05 16:59     ` [gentoo-user] " Dale
@ 2025-06-05 17:44       ` eric
  2025-06-05 19:50       ` Re[2]: " Stefan Schmiedl
  1 sibling, 0 replies; 24+ messages in thread
From: eric @ 2025-06-05 17:44 UTC (permalink / raw
  To: gentoo-user

On 6/5/25 09:59, Dale wrote:
> I'm not big on the AI thing yet either.  Reminds me of that movie
> Terminator and a few others.  I'm not real sure about us going down that
> road myself.
> 
> One thing I like about the book I linked to, it is new.  It should be
> good for all the new versions of software.  The bad thing about being
> new, no one has wrote a review on it yet.  I was hoping someone here
> might have bought a copy or knew someone who did.  I think I'll risk it
> and just buy the thing.  I'm not looking to create a new distro or
> anything so it should hopefully be good enough, if I can understand what
> it is saying.
> 
> Like that command mountpoint.  I was wondering how one can check if
> something is mounted or not.  No idea that existed.  o_O
> 
> I'll post back when it comes in and I get a chance to read it.  If I can
> figure out what it is saying, it should be good for almost anyone.  😂
> 
> Thanks.
> 
> Dale

Dale,

Have you gotten in touch with the author to see if AI was used to help 
write the code in the book? As the book was released just last month and 
AI has become very popular as a helper with creative and programming 
activities, there is always the chance that using the book will only be 
avoiding AI in the most direct way.  :-)

Sorry, I could not help myself. Both people and AI are fallible, so 
always test your code out as was suggested before using it on your systems.

I have bought many linux books through PackT 
(https://www.packtpub.com/en-us) and Humble Bundles 
(https://www.humblebundle.com/books), even some from Oreilly 
(https://www.oreilly.com/) before they became a subscription service. 
Many of them started out great in the first chapter or two, and then 
whoosh, I could not follow along. I don't know if it was me or the books 
that were causing the misunderstanding. :-)

I hope the book works out great for you and helps you make your goal.

Regards,
Eric



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  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 17:56 ` yahoo
  2025-06-05 18:48   ` Arve Barsnes
  2025-06-05 18:33 ` [gentoo-user] " yahoo
  2025-06-10  9:39 ` Dale
  3 siblings, 1 reply; 24+ messages in thread
From: yahoo @ 2025-06-05 17:56 UTC (permalink / raw
  To: gentoo-user

Il 05/06/25 05:49, Dale ha scritto:
> Howdy,
> 
> As most know, I have very basic script skills.  Most of you wouldn't
> even call my stuff scripts most likely.  I'm not sure if they meet the
> definition either.  I have quite a few "scripts" that I use to do all
> sorts of things.  I use scripts to unlock and mount encrypted drive
> sets, update backups and all that sort of thing.  I'd like to add some
> things to my little scripts but don't know how.  I know it can be done
> tho.  Example.  I'd like to add a section that when I run a script to
> unlock and mount a drive set, I'd like it to check and make sure it
> isn't already open and/or mounted.  If it is not one or both of those
> things, then do whichever one, or both, that are not already done.  For
> my backup scripts, I'd like to add a section that makes sure the drive
> set for the backup is unlocked and mounted first.  If not, print out
> that it is not mounted and stop.  I wouldn't mind learning some other
> stuff to.  I just want to keep the cost down a bit, used is also a
> option if in real good shape.  I also don't want to buy a book that
> doesn't have what I need.
Advanced Bash-Scripting Guide (https://tldp.org/LDP/abs/html/)

Available for free online so you can see if all you need is in, or in 
printed version from various resources. Full of code snippets to get you 
started.

It's not an easy read but the fault is bash, not the author's!
bash syntax looks like it was studied to make you forget even the 
simplest things in no time, if you don't use it everyday (which I don't).

raffaele


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  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 17:56 ` yahoo
@ 2025-06-05 18:33 ` yahoo
  2025-06-10  9:39 ` Dale
  3 siblings, 0 replies; 24+ messages in thread
From: yahoo @ 2025-06-05 18:33 UTC (permalink / raw
  To: gentoo-user

Il 05/06/25 05:49, Dale ha scritto:
> 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
> 
> 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.

I doubt anybody would find useful and complete the "Setting up a Linux 
environment" page visible in the preview.

Also, 120 pages to explain Linux commands _and_ bash seem too few to 
really progress you from beginner to advanced.

raffaele


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-05 17:56 ` yahoo
@ 2025-06-05 18:48   ` Arve Barsnes
  2025-06-05 19:05     ` Eli Schwartz
  0 siblings, 1 reply; 24+ messages in thread
From: Arve Barsnes @ 2025-06-05 18:48 UTC (permalink / raw
  To: gentoo-user

On Thu, 5 Jun 2025 at 19:56, yahoo <mentadent47@yahoo.com> wrote:
> Advanced Bash-Scripting Guide (https://tldp.org/LDP/abs/html/)
>
> Available for free online so you can see if all you need is in, or in
> printed version from various resources. Full of code snippets to get you
> started.

Also the bash book from the bunch of programming books created by the
StackOverflow bunch a few years ago. I remember those got good
feedback.

https://goalkicker.com/BashBook/

Regards,
Arve


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-05 18:48   ` Arve Barsnes
@ 2025-06-05 19:05     ` Eli Schwartz
  2025-06-08  0:09       ` [gentoo-user] " Nuno Silva
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Schwartz @ 2025-06-05 19:05 UTC (permalink / raw
  To: gentoo-user


[-- Attachment #1.1: Type: text/plain, Size: 768 bytes --]

On 6/5/25 2:48 PM, Arve Barsnes wrote:
> On Thu, 5 Jun 2025 at 19:56, yahoo <mentadent47@yahoo.com> wrote:
>> Advanced Bash-Scripting Guide (https://tldp.org/LDP/abs/html/)
>>
>> Available for free online so you can see if all you need is in, or in
>> printed version from various resources. Full of code snippets to get you
>> started.
> 
> Also the bash book from the bunch of programming books created by the
> StackOverflow bunch a few years ago. I remember those got good
> feedback.
> 
> https://goalkicker.com/BashBook/
> 
> Regards,
> Arve


https://mywiki.wooledge.org/BashGuide is a must-read, I would say. In
fact, the entire wiki is an excellent reference manual for both
beginners and knowledgeable developers.


-- 
Eli Schwartz

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re[2]: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-05 16:59     ` [gentoo-user] " Dale
  2025-06-05 17:44       ` eric
@ 2025-06-05 19:50       ` Stefan Schmiedl
  2025-06-06  2:58         ` Dale
  1 sibling, 1 reply; 24+ messages in thread
From: Stefan Schmiedl @ 2025-06-05 19:50 UTC (permalink / raw
  To: gentoo-user, gentoo-user

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

------ Original Message ------
From "Dale" <rdalek1967@gmail.com>
To gentoo-user@lists.gentoo.org
Date 05.06.2025 18:59:36
Subject Re: [gentoo-user] Books about making shell scripts and other 
nifty commands.

>
>Like that command mountpoint.  I was wondering how one can check if
>something is mounted or not.  No idea that existed.  o_O

Get into the habit of perusing `apropos` when you're bored or 
investigating:

~ % apropos -s 1 mount
free (1)             - Display amount of free and used memory in the 
system
fusermount (1)       - mount and unmount FUSE filesystems
mountpoint (1)       - see if a directory or file is a mountpoint
restic-mount (1)     - Mount the repository
sleep (1)            - delay for a specified amount of time

Unix systems do not only feed you fish, they also teach you how to fish.
You just need to ask.

TIL: I can mount my restic backups for quick "whoops" restorations :-)

s.

[-- Attachment #2: Type: text/html, Size: 3701 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-05 19:50       ` Re[2]: " Stefan Schmiedl
@ 2025-06-06  2:58         ` Dale
  0 siblings, 0 replies; 24+ messages in thread
From: Dale @ 2025-06-06  2:58 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]

Stefan Schmiedl wrote:
> ------ Original Message ------
> From "Dale" <rdalek1967@gmail.com <mailto:rdalek1967@gmail.com>>
> To gentoo-user@lists.gentoo.org <mailto:gentoo-user@lists.gentoo.org>
> Date 05.06.2025 18:59:36
> Subject Re: [gentoo-user] Books about making shell scripts and other
> nifty commands.
>
>>  
>> Like that command mountpoint.  I was wondering how one can check if
>> something is mounted or not.  No idea that existed.  o_O 
>
> Get into the habit of perusing `apropos` when you're bored or
> investigating:
>
> ~ % apropos -s 1 mount
> free (1)             - Display amount of free and used memory in the
> system
> fusermount (1)       - mount and unmount FUSE filesystems
> mountpoint (1)       - see if a directory or file is a mountpoint
> restic-mount (1)     - Mount the repository
> sleep (1)            - delay for a specified amount of time
>
> Unix systems do not only feed you fish, they also teach you how to fish.
> You just need to ask.
>
> TIL: I can mount my restic backups for quick "whoops" restorations :-)
>
> s.


Thanks for that info.  I've never heard of that command before.  Someone
got tired of digging and made a neat tool.  I've learned a couple things
already.  Now to remember them.  LOL

Thanks much.

Oh, book ordered.  They say it should be here by next Tuesday but
recently, some orders arrive early.  We'll see. 

Dale

:-)  :-) 

[-- Attachment #2: Type: text/html, Size: 5120 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [gentoo-user] Re: Books about making shell scripts and other nifty commands.
  2025-06-05 17:19       ` Eli Schwartz
@ 2025-06-06 14:14         ` Nuno Silva
  0 siblings, 0 replies; 24+ messages in thread
From: Nuno Silva @ 2025-06-06 14:14 UTC (permalink / raw
  To: gentoo-user

On 2025-06-05, Eli Schwartz wrote:

> On 6/5/25 12:16 PM, Mark Knecht wrote:
>> <hehe>
>> 
>> I sense a certain overriding fear about the future...
>> 
>> </hehe>
>
>
> I'm not worried about the future, I'm worried about today, and today's
> users seeking help and getting led astray.
>
>
>> To each his own. I agree with you in general - don't trust AI with
>> anything important. If you prefer then 'trust but verify'.
>
>
> I don't consider AI to provide value enhancement for me at all, for much
> the same reason as described at
>
> https://infosec.exchange/@david_chisnall/113690087142854474
>
> It saves time on writing code. It costs *more* time in debugging subtle
> edge cases. This is a steep disadvantage for a technology that is full
> of questions about legal liability!
>
> Of course, your mileage may vary... if it's only for personal use you
> may not care about legal liability, and if you couldn't write it
> yourself at all then maybe the debugging is worth it.

Edge cases, corner cases, implementation details and non-portable
features are reasons why you'd want to *avoid* "GenAI" for shell
scripting.

I'd say a bit of shell scripting is being aware of what the conditions
to be careful with are. That sounds precisely like the kind of thing at
least some public GenAIs might fail at. Possibly even if you stick to
GNU bash and Linux (which shouldn't be a problem unless you plan on your
scripts being used on other systems).


I can't forget the moment when I got a GenAI telling me how to use
killall to kill processes *by name* in Solaris [1]. That said, maybe
that public model was defective, given it claimed the white side of a
Space Shuttle Orbiter goes *down* on top of a carrier aircraft...

[1] https://social.sdf.org/@njsg/113130981279894435

-- 
Nuno Silva



^ permalink raw reply	[flat|nested] 24+ messages in thread

* [gentoo-user] Re: Books about making shell scripts and other nifty commands.
  2025-06-05 19:05     ` Eli Schwartz
@ 2025-06-08  0:09       ` Nuno Silva
  0 siblings, 0 replies; 24+ messages in thread
From: Nuno Silva @ 2025-06-08  0:09 UTC (permalink / raw
  To: gentoo-user

On 2025-06-05, Eli Schwartz wrote:

> On 6/5/25 2:48 PM, Arve Barsnes wrote:
>> On Thu, 5 Jun 2025 at 19:56, yahoo <mentadent47@yahoo.com> wrote:
>>> Advanced Bash-Scripting Guide (https://tldp.org/LDP/abs/html/)
>>>
>>> Available for free online so you can see if all you need is in, or in
>>> printed version from various resources. Full of code snippets to get you
>>> started.
>> 
>> Also the bash book from the bunch of programming books created by the
>> StackOverflow bunch a few years ago. I remember those got good
>> feedback.
>> 
>> https://goalkicker.com/BashBook/
>> 
>> Regards,
>> Arve
>
>
> https://mywiki.wooledge.org/BashGuide is a must-read, I would say. In
> fact, the entire wiki is an excellent reference manual for both
> beginners and knowledgeable developers.

Seconded, it's the reference I was going to suggest in this thread. It
has not only documentation on at least some Bash features, but also
content about the details one might have to worry about (such as looping
over file names). Random examples:

   https://mywiki.wooledge.org/BashPitfalls
   https://mywiki.wooledge.org/BashFAQ
   https://mywiki.wooledge.org/ParsingLs
   https://mywiki.wooledge.org/DontReadLinesWithFor
   https://mywiki.wooledge.org/BashGuide/Arrays

The person who asked for suggestions is focused on GNU bash, but this
wiki also has content on portability

   https://mywiki.wooledge.org/Bashism

-- 
Nuno Silva



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-05  3:49 [gentoo-user] Books about making shell scripts and other nifty commands Dale
                   ` (2 preceding siblings ...)
  2025-06-05 18:33 ` [gentoo-user] " yahoo
@ 2025-06-10  9:39 ` Dale
  2025-06-10 10:33   ` Quico Jurado
  2025-06-10 14:33   ` Mark Knecht
  3 siblings, 2 replies; 24+ messages in thread
From: Dale @ 2025-06-10  9:39 UTC (permalink / raw
  To: gentoo-user

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. 

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

:-)  :-) 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-10  9:39 ` Dale
@ 2025-06-10 10:33   ` Quico Jurado
  2025-06-10 14:33   ` Mark Knecht
  1 sibling, 0 replies; 24+ messages in thread
From: Quico Jurado @ 2025-06-10 10:33 UTC (permalink / raw
  To: gentoo-user

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!


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-10  9:39 ` Dale
  2025-06-10 10:33   ` Quico Jurado
@ 2025-06-10 14:33   ` Mark Knecht
  2025-06-10 15:01     ` Eli Schwartz
                       ` (2 more replies)
  1 sibling, 3 replies; 24+ messages in thread
From: Mark Knecht @ 2025-06-10 14:33 UTC (permalink / raw
  To: gentoo-user

On Tue, Jun 10, 2025 at 2: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.
>
> 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
>
> :-)  :-)
>

<hehe> Don't listen to me....


In bash scripting, what purpose do { and } serve?

In Bash scripting, { and } have several purposes depending on the context:

Command Grouping:

Used to group multiple commands into a single unit. This is useful for
executing a set of commands in a specific context, such as within an
if statement or redirecting output.

Example:

bash

{ echo "Hello"; echo "World"; } > output.txt

This redirects both echo commands' output to output.txt.

Brace Expansion:

Allows generating multiple strings based on a pattern, often used for
file and directory creation.

Example:

bash

echo {A,B,C}

Outputs: A B C

Array Definition (in newer versions of Bash):

Used to define an array or reference elements within an array.

Example:

bash

my_array=(one two three)
echo ${my_array[1]}  # Outputs "two"

Function Definitions:

Used when defining a function in Bash.

Example:

bash

my_function() {
    echo "Hello from the function!"
}
my_function

Would you like to see how {} interacts with networking-related tasks?
Maybe for automation with server configurations or scripting remote
access methods?


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-10 14:33   ` Mark Knecht
@ 2025-06-10 15:01     ` Eli Schwartz
  2025-06-10 16:24     ` yahoo
  2025-06-10 18:07     ` Dale
  2 siblings, 0 replies; 24+ messages in thread
From: Eli Schwartz @ 2025-06-10 15:01 UTC (permalink / raw
  To: gentoo-user


[-- Attachment #1.1: Type: text/plain, Size: 730 bytes --]

On 6/10/25 10:33 AM, Mark Knecht wrote:
> <hehe> Don't listen to me....


Correct, we should not. Not only is your LLM wrong, you (Mark) did not
proofread the result.

Despite this being the foundation of the criticism you are slyly
referencing with your "hehe".


> In bash scripting, what purpose do { and } serve?
> 
> In Bash scripting, { and } have several purposes depending on the context:
> 
> [...]
> 
> Array Definition (in newer versions of Bash):
> 
> Used to define an array or reference elements within an array.
> 
> Example:
> 
> bash
> 
> my_array=(one two three)
> echo ${my_array[1]}  # Outputs "two"


"array definition"? Are you (Mark, not the LLM) crazy?


-- 
Eli Schwartz

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  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
  2 siblings, 1 reply; 24+ messages in thread
From: yahoo @ 2025-06-10 16:24 UTC (permalink / raw
  To: gentoo-user

Il 10/06/25 16:33, Mark Knecht ha scritto:
> On Tue, Jun 10, 2025 at 2:42 AM Dale <rdalek1967@gmail.com> wrote:
>> The book is nice.  It's just not what I'm looking for.  I may try to
>> find something cheap on Ebay.
>>
> 
> <hehe> Don't listen to me....

Dale asked for a book. LLM was worth mentioning, but insisting on it is 
answering a different question.

raffaele



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-10 14:33   ` Mark Knecht
  2025-06-10 15:01     ` Eli Schwartz
  2025-06-10 16:24     ` yahoo
@ 2025-06-10 18:07     ` Dale
  2025-06-10 18:18       ` Quico Jurado
  2 siblings, 1 reply; 24+ messages in thread
From: Dale @ 2025-06-10 18:07 UTC (permalink / raw
  To: gentoo-user

Mark Knecht wrote:
> On Tue, Jun 10, 2025 at 2: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.
>>
>> 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
>>
>> :-)  :-)
>>
> <hehe> Don't listen to me....
>
>
> In bash scripting, what purpose do { and } serve?
>
> In Bash scripting, { and } have several purposes depending on the context:
>
> Command Grouping:
>
> Used to group multiple commands into a single unit. This is useful for
> executing a set of commands in a specific context, such as within an
> if statement or redirecting output.
>
> Example:
>
> bash
>
> { echo "Hello"; echo "World"; } > output.txt
>
> This redirects both echo commands' output to output.txt.
>
> Brace Expansion:
>
> Allows generating multiple strings based on a pattern, often used for
> file and directory creation.
>
> Example:
>
> bash
>
> echo {A,B,C}
>
> Outputs: A B C
>
> Array Definition (in newer versions of Bash):
>
> Used to define an array or reference elements within an array.
>
> Example:
>
> bash
>
> my_array=(one two three)
> echo ${my_array[1]}  # Outputs "two"
>
> Function Definitions:
>
> Used when defining a function in Bash.
>
> Example:
>
> bash
>
> my_function() {
>     echo "Hello from the function!"
> }
> my_function
>
> Would you like to see how {} interacts with networking-related tasks?
> Maybe for automation with server configurations or scripting remote
> access methods?
>
>


No wonder I was confused.  What they do depends on where or how they are
used.  So, it's like when a word has more than one very different
meaning.  That explains why I couldn't figure out what they did.  I been
reading the links posted by Quico.  I got a feeling learning even just
enough to make a script that does what I want for encrypted drives is
going to be harder than I think. 

One reason I'm wanting books, I can lay in bed and read.  Sometimes I
wish I had a little laptop or something I could use to read web pages or
monitor things with, from the bed.  Sometimes my health says I'm going
to be horizontal not vertical.  It is pretty good at insisting.  o_0  I
did order some more books, little cheaper tho.  Maybe those will help. 


https://www.amazon.com/gp/product/1913842045

https://www.amazon.com/gp/product/1499546653

https://www.amazon.com/gp/product/1913597091


I got to read up on arrays and what they are.  I think the meaning I
have in my head is different when it comes to computer programming. 
Right now, I'm replacing the axle seal on a Kubota L2500 tractor.  It
doesn't just leak, it pours.  I might add, it is 88F here with a
humidity of about 120% or so.  I'm in the shade and I still have to come
in and dry out a bit. 

Dale

:-)  :-) 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-10 16:24     ` yahoo
@ 2025-06-10 18:12       ` Dale
  0 siblings, 0 replies; 24+ messages in thread
From: Dale @ 2025-06-10 18:12 UTC (permalink / raw
  To: gentoo-user

yahoo wrote:
> Il 10/06/25 16:33, Mark Knecht ha scritto:
>> On Tue, Jun 10, 2025 at 2:42 AM Dale <rdalek1967@gmail.com> wrote:
>>> The book is nice.  It's just not what I'm looking for.  I may try to
>>> find something cheap on Ebay.
>>>
>>
>> <hehe> Don't listen to me....
>
> Dale asked for a book. LLM was worth mentioning, but insisting on it
> is answering a different question.
>
> raffaele

I think his point is, reading online may be better.  As bash and other
software is updated, those web pages are also likely updated.  Kinda
hard to update a printed book.  If I had a small laptop or something
that I could read while laying down, I'd prefer a web page over a book. 
I just don't have one and don't want to the expense of getting one really. 

At some point, I'm going to find what I'm looking for.  I got three more
books on the way.  I hope at least one of them will have what I need. 

Dale

:-)  :-) 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-user] Books about making shell scripts and other nifty commands.
  2025-06-10 18:07     ` Dale
@ 2025-06-10 18:18       ` Quico Jurado
  0 siblings, 0 replies; 24+ messages in thread
From: Quico Jurado @ 2025-06-10 18:18 UTC (permalink / raw
  To: gentoo-user

Hello Dale,

The guide is also available in PDF format
(https://tldp.org/LDP/abs/abs-guide.pdf), this makes it possible to
print the chapters that you find relevant for your purpose.

Cheers,

On Tue, Jun 10, 2025 at 8:08 PM Dale <rdalek1967@gmail.com> wrote:
>
> Mark Knecht wrote:
> > On Tue, Jun 10, 2025 at 2: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.
> >>
> >> 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
> >>
> >> :-)  :-)
> >>
> > <hehe> Don't listen to me....
> >
> >
> > In bash scripting, what purpose do { and } serve?
> >
> > In Bash scripting, { and } have several purposes depending on the context:
> >
> > Command Grouping:
> >
> > Used to group multiple commands into a single unit. This is useful for
> > executing a set of commands in a specific context, such as within an
> > if statement or redirecting output.
> >
> > Example:
> >
> > bash
> >
> > { echo "Hello"; echo "World"; } > output.txt
> >
> > This redirects both echo commands' output to output.txt.
> >
> > Brace Expansion:
> >
> > Allows generating multiple strings based on a pattern, often used for
> > file and directory creation.
> >
> > Example:
> >
> > bash
> >
> > echo {A,B,C}
> >
> > Outputs: A B C
> >
> > Array Definition (in newer versions of Bash):
> >
> > Used to define an array or reference elements within an array.
> >
> > Example:
> >
> > bash
> >
> > my_array=(one two three)
> > echo ${my_array[1]}  # Outputs "two"
> >
> > Function Definitions:
> >
> > Used when defining a function in Bash.
> >
> > Example:
> >
> > bash
> >
> > my_function() {
> >     echo "Hello from the function!"
> > }
> > my_function
> >
> > Would you like to see how {} interacts with networking-related tasks?
> > Maybe for automation with server configurations or scripting remote
> > access methods?
> >
> >
>
>
> No wonder I was confused.  What they do depends on where or how they are
> used.  So, it's like when a word has more than one very different
> meaning.  That explains why I couldn't figure out what they did.  I been
> reading the links posted by Quico.  I got a feeling learning even just
> enough to make a script that does what I want for encrypted drives is
> going to be harder than I think.
>
> One reason I'm wanting books, I can lay in bed and read.  Sometimes I
> wish I had a little laptop or something I could use to read web pages or
> monitor things with, from the bed.  Sometimes my health says I'm going
> to be horizontal not vertical.  It is pretty good at insisting.  o_0  I
> did order some more books, little cheaper tho.  Maybe those will help.
>
>
> https://www.amazon.com/gp/product/1913842045
>
> https://www.amazon.com/gp/product/1499546653
>
> https://www.amazon.com/gp/product/1913597091
>
>
> I got to read up on arrays and what they are.  I think the meaning I
> have in my head is different when it comes to computer programming.
> Right now, I'm replacing the axle seal on a Kubota L2500 tractor.  It
> doesn't just leak, it pours.  I might add, it is 88F here with a
> humidity of about 120% or so.  I'm in the shade and I still have to come
> in and dry out a bit.
>
> Dale
>
> :-)  :-)
>


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2025-06-10 18:19 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox