From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 597EF1580E0 for ; Tue, 10 Jun 2025 18:19:33 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 41E92342DFA for ; Tue, 10 Jun 2025 18:19:33 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 3A7F41104B8; Tue, 10 Jun 2025 18:18:28 +0000 (UTC) Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 442331103DD for ; Tue, 10 Jun 2025 18:18:27 +0000 (UTC) Received: by mail-yb1-xb2e.google.com with SMTP id 3f1490d57ef6-e731a56e111so5151243276.1 for ; Tue, 10 Jun 2025 11:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749579506; x=1750184306; darn=lists.gentoo.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bBFmmswflyJycg1moJQSnVFSKtkE+JS5MMm8X+qIJak=; b=FnYDca6Mnk8Lg2q3WWlan8c/SfePngn6oR9ZNDm4W8jQkkPzjKthXbsZADQRlKrk0q Bm/4JdKU8eJxi4XnMgzFRr47XOpFxEoVJ/jj+UJeH9LRcwkFra3qpDLsOKuXapdfh5L6 FVUlOrbRjoe51r7ia4ef1TzpQCN5b5a8Q8qA0iYk5WlZADyP0BjADsk4kAt0hxTfnT5f KT6O02/M+QwPt6fcwjy2j0sryDaVWNnS8AfQq1797AOCR9xl2/2QVHmSoiu1FGfsszGz iS9QtPqXX1sIWN55icFTc9jZfM+LoDuyLirfjQoP1NuXkNj3lBRWgpXsDo0MOtl1+hXY S19w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749579506; x=1750184306; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bBFmmswflyJycg1moJQSnVFSKtkE+JS5MMm8X+qIJak=; b=tZX/wkOYL5H6oPJsgIB+NfkD7vZPJhGVjAQAMtLQVlTwl0QbN73YRO8hJSAGwMku5a 9RkpNtvBtTIVNH8W1K1CUQEZV3+QMHH3cfgxdtyCgenFaWlcmM4b4rZY3aaNaLOf9/ni lDA+TEJ7V4HOlVU1bvpH4Tm6a/rREHNn2liLjzo1jg9yA509Y/Q8D+pYkivpTi1aCWtS wvtNc0rZuSh4bbS+WbN/+qC/kr7xK4buJWZO7OtV9gfLINdrBplVoToK+cH8OSxoHqlR qbTeTgA/9yX8mMK4eu6mhRz/4FS96VDostmZJnedshDRsrvxbwcGX0mcBpnpmt9BG1AS OtTw== X-Gm-Message-State: AOJu0YzbYq3pgm+lot/VY9kzXjKqNb/jzpT/tcZKwvUIZjktCigwcqLs YXkCURYxE88tPIA9EsxByMxuZZYIYrSt9IcCM+JmgaOPGxa4I8w5CYSxE70lPj8QxZaqya4poxk Jwan4yUZu6qD4Uqp43/TVaAVHORRgPtNVXegj X-Gm-Gg: ASbGncuzgEgL5eKJ5K6TNKZVFWjGfz0aAHcpzbI26XVFsZCyHaSKY5F2jdc92KRGxA3 w/0yNVCsPdt9qPd5z9mPx/8ELDDutZZnDQqGzQOk13CYZa99E0GA5LygtNX7oiisL6XEwSj5gtJ BjwcoOourIMpXCtjDwpxwrBT527UWAIu+j6OQ+eUK7uslCTlXoE2U1TkEmJEYE9U3E8Rr6CGRzJ PepAfuiXbDpzdc2 X-Google-Smtp-Source: AGHT+IFN3Je1R4mjUOZYFtBLhdr95zFu2cySXi1Zj7kk01U0FeeUlILWLx3MdXzLPAai+eJraEFSPHF6bkR5+MwZVik= X-Received: by 2002:a05:6902:1687:b0:e7d:d037:c78b with SMTP id 3f1490d57ef6-e81fd9484a1mr967520276.15.1749579506059; Tue, 10 Jun 2025 11:18:26 -0700 (PDT) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 References: <1a0acd33-22d2-d378-6d8d-87a5302242f8@gmail.com> <9dfe9688-942b-bb7e-9b7c-e1371747ab55@gmail.com> In-Reply-To: <9dfe9688-942b-bb7e-9b7c-e1371747ab55@gmail.com> From: Quico Jurado Date: Tue, 10 Jun 2025 20:18:14 +0200 X-Gm-Features: AX0GCFv1E2gQqaqCT62Z2nCLjJXwbMdUepgOdN8FOyxwckA4uzRFid0YhAt3obg Message-ID: Subject: Re: [gentoo-user] Books about making shell scripts and other nifty commands. To: gentoo-user@lists.gentoo.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 11b4ead7-d8db-49d3-888d-6bc6b3a9d92d X-Archives-Hash: e39cf66cf547cdcec4982df33551570f 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=E2=80=AFPM Dale wrote: > > Mark Knecht wrote: > > On Tue, Jun 10, 2025 at 2:42=E2=80=AFAM Dale wro= te: > >> Dale wrote: > >>> Howdy, > >>> > >>> <<< SNIP >>> > >>> So, I'm looking for a book, paperback would be nice but hardback is f= ine > >>> 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 ou= t > >>> with given my VERY basic skills? Know of something better? When I w= as > >>> a kid, I was pretty good with BASIC on the old Commodore VIC-20 and 6= 4. > >>> 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 i= t > >> is not, mount the drive. I'd also like it to print out what it is doi= ng > >> 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 simp= le > >> 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 ou= t > >> 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 t= o > >> do what I want to do and understand it as well. If someone has a scri= pt > >> 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 b= e > >> 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 > >> > >> :-) :-) > >> > > Don't listen to me.... > > > > > > In bash scripting, what purpose do { and } serve? > > > > In Bash scripting, { and } have several purposes depending on the conte= xt: > > > > 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=3D(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 > > :-) :-) >