How to End file in Programming done in arduino

Hi! This is my code. Working fine

void setup()
 {
 
  Serial.begin(9600);
 }

void loop()  
{
  int s1[2];
  int s2[2];
  s1[1] = analogRead(A1);
  s2[1] = analogRead(A2);
  Serial.println(s1[1]);
  Serial.println(s2[1]);
  delay(1000);
  s1[2] = analogRead(A1);
  s2[2] = analogRead(A2);
  if((s1[1]<s1[2])&&(s2[1]>s2[2]))
          {
                  exit(1); 
          }
  else
          {  
          Serial.println(s1[2]);
          Serial.println(s2[2]);
          delay(1000);  
          }
}

Now the problem is I want to Apply EOF in my code. The above code works fine. Definately a question come to your mind why I have to use End of file in my code. I want to run the above code using shell script in terminal in ubuntu.I have done this by using the command sudo /dev/ttyUSB0 > sensor.txt. This command puts the data of ttyUSB0 to the file called sensor.txt. But when My code end means no more reading is coming from my sensor to the arduino serial monitor or to the text file or to ttyUSB0 my script doesnot end. I think that script doesnot have end of file. This is the reason It is not ending. I am giving you the link of my github from where you can view my code of shell scipt. GitHub - sanpreet/Automation-of-Universal-Testing-Machine: Contains the code written for the Automation. There are five files and I have to add content to read me files. Otherfiles are ready. Even if I have tried EOF in file ttyUSB0.sh but no result. So Now I am feeling Should I insert EOF in Sensor_logic.uno. These files are contained in github. You can view them

I am trying my best to explain the problem. Help is needed.

You are not being shown the main() function. It is hidden from you. When loop() ends, main() starts it again.

main()
{
LOOPER:
loop()
{
public logic()
}
goto LOOPER;
}

Now the problem is I want to Apply EOF in my code.

What character is that exactly?

AmbiLobe:
You are not being shown the main() function. It is hidden from you. When loop() ends, main() starts it again.

main()
{
LOOPER:
loop()
{
public logic()
}
goto LOOPER;
}

You are making this up. The main function does not have a goto in it. Nor would that compile.

I think I understand what you're trying to do, although I don't understand why you're doing it.

I don't know what the EOF character is in ubuntu but many UNIX-based systems I work on use ^D (4) as an EOF character so you could try that and see whether your ubuntu shell recognises that as EOF.