Subj : Re: Some linux code co commands
To   : Gert Koefoed Andersen
From : Wilfred van Velzen
Date : Fri Dec 10 2010 11:19 am

Hi,

On 09 Dec 10 23:10, Gert Koefoed Andersen wrote to All:
  about: "Some linux code co commands":

 GKA> In linux I have this command and functions in mind nad use.

 GKA> ---snip---
 GKA> if [ -a nodelist.${num} ]; then goto latest; fi
 GKA>    else
 GKA>     cp nodelist.${oldnum} /home/fido/makenl/z115fake/
 GKA> goto chckfile

 GKA> :latest
 GKA> cp nodelist.${num} /home/fido/makenl/z115fake/

 GKA> :chckfile
 GKA> ####
 GKA> # some other linux command and functions for check and move files here
 GKA> under.
 GKA> ---snip---

You don't need to use goto's in linux shell so do something like this:

if [ -a nodelist.${num} ]; then
  cp nodelist.${num} /home/fido/makenl/z115fake/
else
  cp nodelist.${oldnum} /home/fido/makenl/z115fake/
fi

####
# some other linux command and functions for check and move files here under.

Btw: -f or -s is better then -a. (If your using bash, I don't know if this 
works in other shells)


 GKA> The linux command and function shall could check if the new julian
 GKA> dat
 GKA> nodelist/pasnlist is copied to a place and if it not is the julian day 
file
 GKA> then jump to another section and copy the latest there is, but if it 
there
 GKA> is the julian day file cp it and jump over the section for the old file
 GKA> copy.

 GKA> it could maybe just be done with 2 line of if statements.
 GKA> if [ -a nodelist.${oldnum ]; then copy nodelist.${oldnum}; fi
 GKA> if [ -a nodelist.${num} ]; then copy nodelist.${num}; fi

Ok, except for copy -> cp and you forgot the destination of the copy! ;)

 GKA> so the function only copy the old nodelist when it not find the
 GKA> julian fay
 GKA> nodelist there will be the next weeks nodelist.


Bye, Wilfred.


--- FMail/Win32 1.62.GPL
 * Origin: Amiga Offline BBS Lisse (2:280/464)