Skip to content

Instantly share code, notes, and snippets.

@nikAizuddin
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save nikAizuddin/6969aa49656c7a68277c to your computer and use it in GitHub Desktop.

Select an option

Save nikAizuddin/6969aa49656c7a68277c to your computer and use it in GitHub Desktop.
BCN2053 Operating System Lab Sheet 6 (BASH)
#!/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