Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Why I am getting error in done statement, I am not able to fix this

+4 votes
asked Feb 12, 2023 by Nirali Patel (750 points)
#!/bin/bash
File=TagNumber
echo "$File"
while read -r line
  do
    echo "$line"
    Amount_paid= Amount_paid + Amount_paid | bc
    printf %date+ %mm-%dd-%Y , %dd.cc
  done

1 Answer

0 votes
answered Feb 13, 2023 by Peter Minarik (84,720 points)

I think when you copy-paste code into the OnlineGDB it gets confused over line end characters.

You should make sure your lines in your file on your computer do not contain \r\n (Windows line endings) but \n only (Linux line endings) before copying the code to OnlineGDB.

If I do this for your code, it runs (but contains further issues).

I'd recommend using Notepad++ and you can click Edit/EOL Conversion/Unix (LF).

Good luck!

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...