>>>>> "Voytek" == Voytek Eymont <[email protected]> writes:

Voytek> I'm trying to put together a basic script, it works fine when
Voytek> I run it as root, but, I'm having issues when I try to run as
Voytek> 'voytek'

Voytek> $ ls -al /usr/local/bin/ccc -rwxr-x--- 1 root voytek 1409 May
Voytek> 9 08:19 /usr/local/bin/ccc

This looks OK.  


Voytek> /usr/local/bin/ccc: line 16: ccc.txt: Permission denied mv:
Voytek> overwrite `ccc.old', overriding mode 0644?  rm: remove
Voytek> write-protected regular file `logout.html'?  rm: remove
Voytek> write-protected regular file `logout.html'?  logout.html:
Voytek> Permission denied

What directory are you running in?  I'd add
     cd /var/tmp
early in the script so you know you're running in a place you have
write access to.


Voytek> script fetches a html page, parses it several times, then
Voytek> emails some text from it

Voytek> when starting the script should I say 'cd /var/tmp' (to have
Voytek> temp files in/var/tmp?)

Yes.  Actually, I'd do something like:

 TMP="/var/tmp/`basename $0`$$"
 mkdir -p "$TMP"
 cd "$TMP"
 trap 'cd /var/tmp; rm -rf "$TMP"' 0

to create a place where you can work, that'll get cleaned up afterwards.


--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to