Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6472319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:19:47+00:00 2026-05-25T06:19:47+00:00

W/hen i run the following code snippet #!/bin/bash if [ foo = foo ];

  • 0

W/hen i run the following code snippet

#!/bin/bash
if [ "foo" = "foo" ];
then
echo "true"
else
echo "false"
fi
echo "end"

i get

sfm_write_buffer_test.sh: line 9: syntax error: unexpected end of file

this doesn’t make any sense. echo statements works fine, but when the if statement is encountered it gives the above mentioned error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:19:47+00:00Added an answer on May 25, 2026 at 6:19 am

    You’re on Cygwin, right?

    As I said in a comment, when I copy-and-paste your script and run it on my system, it works; the output is

    true
    end
    

    But when I change the line endings from the Unix style '\n' to the Windows style '\r\n', I get the same error you got.

    With the Windows-style line endings, bash doesn’t see the then keyword; it sees a command named then\r. It never tries to execute it because it’s scanning for the matching then or fi for the if keyword (which it recognized because it’s not at the end of the line).

    Make sure your shell scripts use Unix-style line endings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey, if anyone could please help me then it would be much appreciated. Basically,
<asp:TextBox ID=Textboxtotalamount OnTextChanged=AmountChanged Width=90px AutoPostBack=true runat=server> </asp:TextBox> <asp:RequiredFieldValidator ID=RequiredFieldValidator runat=server ControlToValidate=Textboxtotalamount SetFocusOnError=True ValidationGroup=val>*</asp:RequiredFieldValidator> <asp:RegularExpressionValidator
How can you fix this SQL-code? My Python code: import os, pg, sys, re,
class Hen { friend class Nest ; class Nest { int n ; friend
i have three simple images of a hen which i am trying to animate(hen
Does anyone know IF , WHEN or HOW I can get Memcached running on
I'm looking for a regular expression that checks whether a string contains 2 specific
Okay I have 2 files. One file is data that is updated every 10
i have set sesssion lik this Session[page + GridView1.PageIndex] = values; Now hwen next
I have a question! I want to print an unicode string in php (like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.