LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-14-2015, 12:14 AM   #1
rykenknight04
LQ Newbie
 
Registered: May 2015
Posts: 1

Rep: Reputation: Disabled
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
 
Old 05-14-2015, 12:20 AM   #2
ardvark71
LQ Veteran
 
Registered: Feb 2015
Location: Oregon, USA
Distribution: Lubuntu 14.04, Windows Vista
Posts: 5,184
Blog Entries: 3

Rep: Reputation: 694Reputation: 694Reputation: 694Reputation: 694Reputation: 694Reputation: 694
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...

Last edited by ardvark71; 05-14-2015 at 12:22 AM. Reason: Correction/Added greeting.
 
Old 05-14-2015, 01:20 AM   #3
alan99
Member
 
Registered: Mar 2010
Distribution: Debian
Posts: 180

Rep: Reputation: 31
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.

Last edited by alan99; 05-14-2015 at 01:21 AM.
 
Old 05-14-2015, 04:38 AM   #4
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 664

Rep: Reputation: 80
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.
 
Old 05-14-2015, 05:55 AM   #5
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 840

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
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.
 
1 members found this post helpful.
Old 05-15-2015, 07:52 AM   #6
JeremyBoden
Member
 
Registered: Nov 2011
Posts: 939

Rep: Reputation: 174Reputation: 174
What is the point of the first 3 lines?
Code:
touch .running
clear
while [ -f .running ]
....
 
Old 05-15-2015, 09:34 AM   #7
jtbinuya
LQ Newbie
 
Registered: Aug 2007
Posts: 11

Rep: Reputation: 0
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)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can i submit LFS project in my college? Carl_cj Linux - Newbie 7 01-05-2015 11:57 PM
mini opengl college project abhishekgit Linux - Software 2 04-20-2013 11:46 AM
In college and taking Linux, using Fedora 9 Fritter LinuxQuestions.org Member Intro 1 04-14-2009 02:31 AM
I bet LFS would make a really great college project perry Linux From Scratch 2 09-26-2007 10:35 AM
Off to College...Taking Linux With Me...on What? DreameR-X Linux - Laptop and Netbook 9 05-02-2005 12:28 AM


All times are GMT -5. The time now is 12:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration