• Some linux code co commands

    From Gert Koefoed Andersen@2:230/150 to All on Thu Dec 9 23:10:00 2010
    * Crossposted in area LINUX, LINUX_BBS
    Hello All!

    I am trying make some script jump by some if statement like the one in dos commands.
    In dos commands is it like this:

    ---snip---
    if exist nodelist.(day) then goto latest
    else
    copy nodelist.(oldday) d:\fido\makenl\z115fake\
    goto chckfile1

    :latest
    copy nodelist.(day) d:\fido\makenl\z115fake\

    :chckfile1
    rem
    rem some other checks commands herunder.
    ----cut----

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

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

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

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

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

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

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



    Take care,
    Gert

    - Get the best with linux -

    --- Msged/LNX 6.2.0 (Linux/2.6.33-gentoo-r2 (x86_64))
    * Origin: * The KofoBBS at http://www.kofobbs.dk * (2:230/150)
  • From Wilfred van Velzen@2:280/464 to Gert Koefoed Andersen on Fri Dec 10 11:13:22 2010
    Hi,

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

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

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

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

    :chckfile
    ####
    # some other linux command and functions for check and move files here under.
    ---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.


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

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

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

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


    Bye, Wilfred.


    --- FMail/Win32 1.62.GPL
    * Origin: Amiga Offline BBS Lisse (2:280/464)
  • From Wilfred van Velzen@2:280/464 to Gert Koefoed Andersen on Fri Dec 10 11:19:58 2010
    Hi,

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

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

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

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

    :chckfile
    ####
    # some other linux command and functions for check and move files here under.
    ---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)


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

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

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

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


    Bye, Wilfred.


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