LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Whe runned separately,works! but combined: can't run terminal! (https://www.linuxquestions.org/questions/linux-newbie-8/whe-runned-separately-works-but-combined-cant-run-terminal-4175523854/)

ivahbee 10-30-2014 10:13 PM

Whe runned separately,works! but combined: can't run terminal!
 
Please can someone help me, i can't seem to see where i went wrong!!
When i ran the script separately, it worked perfectly...output was correct.
But when i put the complete script together, it wont even output an answer.
It kept saying:
./cece.txt: line 64: unexpected EOF while looking for matching `"'
./cece.txt: line 67: syntax error: unexpected end of file


e.g.
echo " "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
echo "^ Employees Payroll Details ^"
echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
echo

echo "Employees Full Name:"
read emp
echo

echo "Numbers of Hours worked in a week:"
read hrs
echo

echo "Hourly Pay Rate:"
read hpr
echo

echo "Federal Tax Rate:"
echo 20%
echo

echo "State Tax Rate:"
echo 9%
echo

a=20
b=100

ftr=$(echo "scale=2;$a/$b"|bc)

c=9
d=100

str=$(echo "scale=2;$c/$d"|bc)

e=$ftr
f=$str
g=$hpr
h=$hrs

grosspay=`expr $g\*$h`
ftw=$(echo "scale=2;$ftr*$grosspay"|bc)
stw=$(echo "scale=2;$str*$grosspay"|bc)
Total_deduct=$(echo "scale=2;$ftw+$stw"|bc)
Deduction=`expr $Total_deduct`
Netpay=$(echo "scale=2;$grosspay+$Total_deduct"|bc)

clear


echo
echo "--------------------------------------------------"
echo "- Payroll Statement -"
echo "--------------------------------------------------"
echo
echo "Employees Full Name: $emp"
echo "Numbers of Hours worked in a week: $hrs hrs"
echo "Hourly Pay Rate: $ $hpr"
echo "Gross Pay: $ $grosspay"
echo "Deduction: $ $Total_deduct"
echo "Federal Tax withholding: $ $ftw"
echo "State Tax withholding: $ $stw"
echo "Total Deductions: $ $Total_deduct"
echo "Net Pay: $ $Netpay"
echo

jpollard 10-30-2014 10:32 PM

Its your first line...

the one:
Code:

echo " "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
You have an extra " at the beginning....

grail 10-31-2014 12:42 AM

Please use [code][/code] tags when displaying code or data.


All times are GMT -5. The time now is 02:39 AM.