It appears you have not registered with our community. To register please click here ...

Author Topic: BASH Script Attempt  (Read 2115 times)

ttumelty

  • Newbie
  • *
  • Posts: 9
  • Karma: +10/-0
    • ICQ Messenger - 9468768
    • AOL Instant Messenger - cowboyway1
    • Yahoo Instant Messenger - tom_tumelty
    • View Profile
    • Email
BASH Script Attempt
« on: December 13, 2005, 07:06:01 PM »
I am writing a script and running into some problems.

The script is supposd to see if a file exists, then loop until the file is present, checking periodically unti the file exists. For test purposes it is set to sleep for 15 minutes and loop again.


Here is the script :


#!/bin/sh

# initialize true and false values
FALSE=1  
TRUE=0

# initializes FILEEXISTS variable
$FILEEXISTS = [ -e tfile.txt;


# test if file exist; if not then loop until it does exist
while (${FILEEXISTS} -eq ${FALSE});  do
 ${FILEEXISTS}= { [ -e tfile.txt}  # TEST IF FILE EXISTS
 # WAIT 15 MINUTES and check again for file
 exec sleep 15m
done
   

# if file is present use wget to download specified file
if ($FILEEXISTS=${TRUE}); then
   exec wget



# replace with a URL for test purposes

********************************************************

I am running this as root and it keeps telling me "permission denied".

This is my first Bash script and i am not sure of the syntax either.


Thank You in advance,
Tom

dynaweb

  • <b>Canine Deamon</b>
  • Administrator
  • Sr. Member
  • *****
  • Posts: 493
  • Karma: +10/-0
  • Generic personal text here ...
    • MSN Messenger - danno_d_manno@yahoo.com
    • View Profile
    • DynaWeb Designs
    • Email
BASH Script Attempt
« Reply #1 on: December 14, 2005, 08:31:57 AM »
Hi Tom,

If you tell us your distro and filename/path we can try to reproduce this error and track down the problem from there.
Those who cannot learn from history are doomed to repeat it. -- Linux learns.

ttumelty

  • Newbie
  • *
  • Posts: 9
  • Karma: +10/-0
    • ICQ Messenger - 9468768
    • AOL Instant Messenger - cowboyway1
    • Yahoo Instant Messenger - tom_tumelty
    • View Profile
    • Email
BASH Script Attempt
« Reply #2 on: December 14, 2005, 09:04:47 AM »
Slackware 10.1
/trig/  is the directory i created for this

Thank You very much.
Tom

ttumelty

  • Newbie
  • *
  • Posts: 9
  • Karma: +10/-0
    • ICQ Messenger - 9468768
    • AOL Instant Messenger - cowboyway1
    • Yahoo Instant Messenger - tom_tumelty
    • View Profile
    • Email
BASH Script Attempt
« Reply #3 on: December 14, 2005, 09:06:18 AM »
trigger.sh   is the file name

dynaweb

  • <b>Canine Deamon</b>
  • Administrator
  • Sr. Member
  • *****
  • Posts: 493
  • Karma: +10/-0
  • Generic personal text here ...
    • MSN Messenger - danno_d_manno@yahoo.com
    • View Profile
    • DynaWeb Designs
    • Email
BASH Script Attempt
« Reply #4 on: December 14, 2005, 09:25:52 AM »
Did you remember to chmod to 700?
 
Code: [Select]
# chmod 700 /trig/trigger.sh
Those who cannot learn from history are doomed to repeat it. -- Linux learns.

ttumelty

  • Newbie
  • *
  • Posts: 9
  • Karma: +10/-0
    • ICQ Messenger - 9468768
    • AOL Instant Messenger - cowboyway1
    • Yahoo Instant Messenger - tom_tumelty
    • View Profile
    • Email
BASH Script Attempt
« Reply #5 on: December 14, 2005, 09:31:31 AM »
aaaahhhh  thank you!!!!

dynaweb

  • <b>Canine Deamon</b>
  • Administrator
  • Sr. Member
  • *****
  • Posts: 493
  • Karma: +10/-0
  • Generic personal text here ...
    • MSN Messenger - danno_d_manno@yahoo.com
    • View Profile
    • DynaWeb Designs
    • Email
BASH Script Attempt
« Reply #6 on: December 30, 2005, 04:22:57 PM »
Our pleasure helping you with your bash script.  Please join our Linux forums and return the favor by helping others.  Have a great new year!
Those who cannot learn from history are doomed to repeat it. -- Linux learns.

 

Related Topics

  Subject / Started by Replies Last post
1 Replies
1851 Views
Last post March 28, 2006, 10:11:04 AM
by dynaweb
1 Replies
1750 Views
Last post June 29, 2006, 11:26:50 AM
by zelo
1 Replies
3764 Views
Last post December 07, 2008, 02:11:11 PM
by Telepod
0 Replies
1527 Views
Last post September 17, 2006, 11:20:00 AM
by dynaweb
0 Replies
2109 Views
Last post January 10, 2007, 10:33:51 PM
by dynaweb