0

Code

 #! /bin/bash
    read -p "INterest " interest
    read -p "Enter loan " loan

    tot(){
        total=$( bc -l <<EOF
            scale=3
            $loan + $interest^3
            EOF
    )
        echo "$total"
    }

    tot

output INterest 12 Enter loan 12 ./eofp.sh: line 6: unexpected EOF while looking for matching `)' ./eofp.sh: line 15: syntax error: unexpected end of file

Imthath
  • 81
  • 1
  • 10

1 Answers1

0

Your here document is terminated wrongly; either

  1. start the here document with <<-EOF and indent using tabs or
  2. put EOF on a line without any other characters.
l0b0
  • 52,149
  • 24
  • 132
  • 195