Taking Linux in college and am currently stumped on a project
Currently taking my first linux course in college and am stuck on a project...details here: https://aacc.instructure.com/courses...item_id=614603
So far this is the code I have come up with but get an error on the 42nd line where it says done. I am not an expert by any means but would like to not struggle and finish this project. Below is my code...any input welcome. #!/bin/bash #blinker #creates a bi-stable process that displays ON and OFF touch .running clear while [ -f .running ] do count=0 while [ -f .running ] do count=$((count+1)) if [ $count -gt 4 ] then break fi echo "Green" sleep 4 done count=0 while [ -f .running ] do count=$((count+1)) if [ $count -gt 4 ] then break fi echo "red" sleep 4 count=0 while [ -f .running ] do count=$((count+1)) if [ $count -gt 2 ] then break fi echo "green" sleep 2 count=0 while [ -f .running ] do done done |
Hi...
Welcome to the forum :) Just as a heads up, clicking on your link leads to a login page only, so there's no way to view your information. ;) Regards... |
I believe it against the rules of this forum (see for details http://www.linuxquestions.org/linux/rules.html ) and probably the ethics of your school. If someone just 'gave' you an answer it would be considered cheating and you wouldn't really learn how to solve problems and troubleshoot code, would you? Also, If you want somebody to look at the error, print line numbers with your statements, it is hard for someone reading your post to have to count the number of lines to find out where the error is.
|
All i can say is you are going a wrong way, as said above we cant do your homework. You have to take the trouble to solve your own problem.
|
Hi,
My first advice would be to format your code. If you use proper indentation, you will immediately see where the flaws in the structure of your code are. Also, if you post your code here, put it within the [code] [/code] tags so that the indentation is preserved. |
What is the point of the first 3 lines?
Code:
touch .running |
running in debug mode would probably give more hints to what your error is pointing to. Have you tried adding set -x at the start of the script just after the shell initialization ( after the 1st three commented lines)
|
All times are GMT -5. The time now is 05:40 AM. |