19 lines
432 B
Bash
Executable File
19 lines
432 B
Bash
Executable File
#!/bin/bash
|
|
|
|
depth=0
|
|
horizontal=0
|
|
while read current; do
|
|
if [[ "$current" == "down "* ]]; then
|
|
current_tmp=${current/down /}
|
|
depth=$((depth+current_tmp))
|
|
elif [[ "$current" == "up "* ]]; then
|
|
current_tmp=${current/up /}
|
|
depth=$((depth-current_tmp))
|
|
elif [[ "$current" == "forward "* ]]; then
|
|
current_tmp=${current/forward /}
|
|
horizontal=$((horizontal+current_tmp))
|
|
fi
|
|
done
|
|
|
|
echo $((depth*horizontal))
|