• Bash script help

    From Michael Dukelsky@2:5020/1042 to Alan Ianson on Thu Oct 17 12:08:16 2019
    Hello Alan,

    Wednesday October 16 2019, Alan Ianson wrote to All:

    I am running the following in a bash script..

    if -f [/path/echomail.out ]; then
    rm /path/echomail.out
    hpt scan
    fi

    When I run this script if the echomail.out file is found it is deleted
    but the next line is not run, and I need it to be..

    Can someone point out what I need to do to get the "hpt scan" part o
    run also?

    Try to put '-f' inside the brackets. The present syntax is incorrect and it is strange bash doesn't complain.

    Michael

    ... node (at) f1042 (dot) ru
    --- GoldED+/LNX 1.1.5-b20170303
    * Origin: ==<<.f1042.ru.>>== (2:5020/1042)
  • From Alan Ianson@1:153/757.2 to Michael Dukelsky on Thu Oct 17 03:05:34 2019
    Hello Michael,

    I am running the following in a bash script..

    if -f [/path/echomail.out ]; then
    rm /path/echomail.out
    hpt scan
    fi

    When I run this script if the echomail.out file is found it is
    deleted but the next line is not run, and I need it to be..

    Can someone point out what I need to do to get the "hpt scan"
    part o run also?

    Try to put '-f' inside the brackets. The present syntax is incorrect
    and it is strange bash doesn't complain.

    I do have the -f inside the "[ ]" in my script, the above was a typo.. :)

    It turns out the cause was that I am running that script with cron so I needed to add the full path to hpt.

    It's working well now, thanks for your message..

    Ttyl :-),
    Al

    ... Artificial intelligence is better than none.
    --- GoldED+/LNX 1.1.5-b20180707
    * Origin: The Rusty MailBox - Penticton, BC Canada (1:153/757.2)