PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, October 30, 2022

[FIXED] Why I'm getting these Errors - unexpected EOF while looking for matching `)'

 October 30, 2022     eof, shell     No comments   

Issue

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


Solution

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.


Answered By - l0b0
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing