Last active
August 29, 2015 14:10
-
-
Save nikAizuddin/6969aa49656c7a68277c to your computer and use it in GitHub Desktop.
BCN2053 Operating System Lab Sheet 6 (BASH)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # ========================================================== | |
| # This script requires user to input the weight | |
| # of the lettuce. The output of the script | |
| # will display the total amount of price base | |
| # on the weight (Assume that 1kg is RM2.50). | |
| # | |
| # Sample output will be: | |
| # | |
| # Enter the weight of lettuce in KG | |
| # [User input] | |
| # Total price is RM[Result] | |
| # Please pay at the counter | |
| # | |
| # Round your answer in 2 dotted decimal. | |
| # ========================================================== | |
| echo "Enter the weight of lettuce in KG" | |
| read weight | |
| total=`echo "scale=2;$weight*2.50" | bc -l` | |
| echo "Total price is RM$total" | |
| echo "Please pay at the counter" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment