Introduction
Captain Blackbeard has hidden his treasure on a remote island and left behind a series of clues encoded as shell variables and arithmetic operations. In this challenge, you will complete a partially written shell script to decode these clues and locate the treasure.
Decoding the Treasure Map
The treasure map has been encoded into a shell script that needs to be completed. The script uses basic arithmetic operations to convert the initial coordinates into the final location. Your task is to fill in the missing values and calculations to reveal where the treasure is buried.
Tasks
Complete the treasure_map.sh script in the /home/labex/project directory by:
- Assigning the correct initial values to the
LATITUDEandLONGITUDEvariables. - Implementing arithmetic operations to calculate
PACES_NORTHandPACES_EAST.
Requirements
- The shell script
treasure_map.shis located in/home/labex/projectwith the following code structure:
#!/bin/bash
## Assign the correct values to these variables
LATITUDE=
LONGITUDE=
## Calculate the paces using arithmetic operations
PACES_NORTH=
PACES_EAST=
## Don't modify the line below
echo "The treasure is buried $PACES_NORTH paces north and $PACES_EAST paces east from the old oak tree."
Use these values and calculations:
- Set
LATITUDEto15. - Set
LONGITUDEto25. - Calculate
PACES_NORTHas latitude multiplied by 2. - Calculate
PACES_EASTas longitude divided by 5.
- Set
The script will output the treasure location in this format:
The treasure is buried X paces north and Y paces east from the old oak tree.
Where X and Y are the calculated values.
Example Output
The treasure is buried 30 paces north and 5 paces east from the old oak tree.
Hints
- Make sure the script is executable by using
chmod +x.
Summary
In this challenge, you have learned the fundamentals of shell scripting:
- Assigning values to variables.
- Performing arithmetic operations in shell scripts.
- Executing scripts and formatting output.
These skills are foundational for more complex shell scripting tasks.



