Mark Knecht wrote:
> On Tue, Jun 10, 2025 at 2:42 AM Dale <[email protected]> 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

:-)  :-) 

Reply via email to