Development > Scripting and Bash

Linux Shell Scripting Cookbook

(1/3) > >>

bitsnpcs:
@Moltke Thank You, your instructions have solved it :)

Moltke:
@bitsnpcs  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`
--- End code ---

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



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.




@Moltke 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 @kpanic 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.

Moltke:

--- Quote ---Is your page the same ?
--- End quote ---


Yes, it is @bitsnpcs  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



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 :) so it's no an error from the book. Thank you for this great idea about creating a thread for the books. :)

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

Navigation

[0] Message Index

[#] Next page

Go to full version