From: Mark Knecht <markknecht@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 07:33:05 -0700 [thread overview]
Message-ID: <CAK2H+eckO5V48YoFGvReEFgPc2578u0iKYDUsWxKWVPpjZQ4Fg@mail.gmail.com> (raw)
In-Reply-To: <e2b98860-96f3-a16f-d933-2a16353e91db@gmail.com>
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?
next prev parent reply other threads:[~2025-06-10 14: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
2025-06-10 14:33 ` Mark Knecht [this message]
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=CAK2H+eckO5V48YoFGvReEFgPc2578u0iKYDUsWxKWVPpjZQ4Fg@mail.gmail.com \
--to=markknecht@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