abhishek
(Abhishek Prakash)
1
If you are following the Bash Basics series on It’s FOSS, you can submit and discuss the answers to the exercise at the end of the chapter:
Fellow experienced members are encouraged to provide their feedback to new members.
Do note that there could be more than one answer to a given problem.
3 Likes
Here is my solution:
#!/bin/bash
price=20
echo "Today's price is: $price"
echo "Tommorrow's price is: $((2*$price))"
The reason I’ve used double quotes is because of something called “Arithmetic Expansion”
PS: Apologies in advance for any confusion caused, I have just started my journey in the world of bash scripting.
abhishek
(Abhishek Prakash)
3
The solution is good.
It would have still been fine if you just ‘hardcoded’ the variables That’s because the arithmetic operations are covered later in the series
But it’s good that you did your research and learned something in advanced
1 Like
Thank you for the kind words @abhishek