Putting 3 commands in one line for scheduled task

  • Hi, how can I put these 3 lines in one command for a monthly scheduled task

    Code
    cd "/srv/dev-disk-by-uuid-....blablabla...../Camera"
    find .trashed* -delete
    find .pending* -delete

    Thanks, regards, Michael

  • Code
    cd "/srv/dev-disk-by-uuid-....blablabla...../Camera" && find .trashed* -delete && find .pending* -delete

    HP t630 Thin Cliënt (AMD Embedded G-Series GX-420GI | QuadCore | 8GB)
    7.0.5-1 (Sandworm) | 64 bit | pve-kernel-6.8 | omvextrasorg 7.0

  • chente

    Hat das Label gelöst hinzugefügt.
  • Or use semi-colons, eg. cmd1; cmd2; cmd3; The difference is that with && each current command must evaluate to true for the next to be evalutead. Truth is determined by the return code of the command, 0 or 1 (0 is true). Type this in, run it, then change true to false: true && echo "hi" If you try it with semicolons, ie: false; echo "hi" it will still print "hi" as each command is independent. && is "and", || is "or", which will try each evaluation and stop once it finds a true value. Try this: false || true && echo "hi" That prints "hi" because the full logic is "if either of these are true, do this". However, this won't print "hi" because it stops at the first true false || true || echo "hi"

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!