Linux Lite Forums
Linux Shell Scripting Cookbook - Printable Version

+- Linux Lite Forums (https://www.freecinema2022.gq/forums)
+-- Forum: Development (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=7)
+--- Forum: Scripting and Bash (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=32)
+--- Thread: Linux Shell Scripting Cookbook (/showthread.php?tid=5591)

Pages: 1 2


Linux Shell Scripting Cookbook - bitsnpcs - 09-17-2018

I heard about this book kindly from [member=7109]Moltke[/member]

Thread for everyone to discuss bash learning from this book.




Re: Linux Shell Scripting Cookbook - bitsnpcs - 09-17-2018

#2 on the same page

I used a lot of time and tried all kind of things for the increment exercise. Including all from Stack Exchange and AskUbuntu on questions about increments, not specifically this book or exercise.

Code:
let no1++

Eventually I tried changing the final line to

Code:
echo $no1

Rather than as I was using which was

Code:
echo $result

From earlier in #2 section.
Felt a bit silly but was glad I got there in the end.

Hope it saves someone some time in making the same mistake as I had.


Re: Linux Shell Scripting Cookbook - Moltke - 09-17-2018


Quote:I found 1 error to date,  page 37 of 384, #3 on the page.

[member=411]bitsnpcs[/member] I can't find that example on page 37. Are you sure it's the correct page? What's the lesson title/about?


Re: Linux Shell Scripting Cookbook - bitsnpcs - 09-17-2018

(09-17-2018, 02:31 AM)Moltke link Wrote:
Quote:I found 1 error to date,  page 37 of 384, #3 on the page.

[member=411]bitsnpcs[/member] I can't find that example on page 37. Are you sure it's the correct page? What's the lesson title/about?

Page number on the actual book says Page 20 (of the chapter 1), page number for the entire book in the pdf reader says page 37 of 384.

It is in the Title "Math with the Shell", under #3

[Image: Screenshot_2018_09_17_03_39_27.png]



Re: Linux Shell Scripting Cookbook - Moltke - 09-17-2018

[member=411]bitsnpcs[/member] and everyone else interested, here's the book's link https://gutl.jovenclub.cu/wp-content/uploads/2013/10/Linux.Shell_.Scripting.Cookbook.pdf


Re: Linux Shell Scripting Cookbook - bitsnpcs - 09-17-2018

[member=7109]Moltke[/member]  Thank You Smile


Re: Linux Shell Scripting Cookbook - bitsnpcs - 09-17-2018

Is your page the same ?
Lets hope I don't have the special edition.


Re: Linux Shell Scripting Cookbook - Moltke - 09-17-2018

Quote:Is your page the same ?


Yes, it is [member=411]bitsnpcs[/member]  Btw, I tried the example and it gave me an error just like you said, but copying/pasting right from the book into the terminal does work. Check it out

[Image: 2h6d1xu.jpg]

I don't know why but it worked, so I guess that rather than being an error in the book there's something we're not doing or we're doing it wrong.

EDIT: I just found out what the problem was: we were using the " ' " symbol rather than " ` " as in the example. I noticed after running it again using the up arrow, since I copied/pasted the whole thing, I thought it should work that way and it did Smile so it's no an error from the book. Thank you for this great idea about creating a thread for the books. Smile


Re: Linux Shell Scripting Cookbook - bitsnpcs - 09-17-2018

This is the result when using the ` instead of the '

[Image: 1a.png]

This is the result not using ` or ' as per my playing with it, (the second running of the file in the terminal, the first is from the above version), the result it is how the book says it should look.


[Image: 1b.png]

[member=7109]Moltke[/member] you are correct, Copying/Pasting from the book or typing it in to the command line does produce 81.0.
It just fails when used as a script that is a file and I am still not sure why that is.

I will edit my earlier post about there being an error in the book.

I'll give this book a miss, I'll stick with the books at home for now.
I may try this book again once I have more experience and can follow it better.

I may even need the book [member=7701]kpanic[/member] described to me "And a child can learn it (with the time they use inall those 'social media' sites)."
I can understand that eg; when learning a new language it is often that you use childrens books in the new language for the first books you read.


Re: Linux Shell Scripting Cookbook - Moltke - 09-17-2018

[member=411]bitsnpcs[/member]  in the first image you get an error because there cannot be spaces between "result=`echo" you wrote "result= `echo" and that's why it didn't work. The whole thing should look like this, with no spaces between " =` " in order to work as it is supposed to:
Code:
$ result=`echo "$no * 1.5" | bc`