Reputation: 1
I'm having a problem with a script I'm writing.
clear
echo "Welcome to the dd interface"
echo "NOTE: When this program executes you will have to provide root access"
echo " "
lsblk
echo " "
read -p "Enter the location of the disk to be imaged: " input_location
echo "Input Location Assigned"
echo " "
read -p "Enter the output location: " output_location
echo "Output Location Assigned"
echo "
1 - 512K
2 - 1024K
3 - 2048K
4 - 4096K
"
blocksize = 0
read -p "Select the write block size to be used: " selection
echo "Block write size selected"
#problem is here
if [[ $selection == 1 ]]; then
blocksize = 512
elif [[ $selection == 2 ]]; then
blocksize = 1024
elif [[ $selection == 3 ]]; then
blocksize = 2048
elif [[ $selection == 4 ]]; then
blocksize = 4096
fi
echo "Options selected:
Input location: $input_location
Output location: $output_location
Block size: $blocksize
"
Bash is seeing the blocksize in the IF statements as a command rather than a variable. How can I fix this?
Upvotes: 0
Views: 47
Reputation: 27266
You shouldn't put spaces around =
on assignments:
blocksize=0
instead of
blocksize = 0
should work.
Upvotes: 2