Hirdetés

Új hozzászólás Aktív témák

  • bambano
    titán

    kozben magam is megtalaltam, hogy subshell-ben fut

    "én a parancs || echo "xsfgkjf" && exit 1 formát próbálnám, az echo mindig igaz értékkel tér vissza."

    ezzel az a gond, hogfy ha az elso ketto kozul barmelyik (akar a parancs, akar az echo) igaz ertekkel ter vissza, a harmadik (exit) resz vegrehajtodik, igy minden esetben kilep a script

    a test-es megoldas jo lehetne, viszont egy ./configure, make, vagy make install ellenorzese (foleg egy file patch-elesenek sikeressege) tul sok tobbletmunkaval jarna

    amit vegul talaltam es mukodik is, az az alabbi:

    parancs || { echo "hiba"; exit 1; }

    sajnos egy forumon leltem ra, ahol csak ennyit irtak, azt nem, hogy mi ez es miert mukodik, ha esetleg tudja valaki, szivesen meghallgatom

    bash man:

    { list; } list is simply executed in the current shell environment. list must be terminated with a newline or semicolon. This is known as a group command. The return status is the exit status of list. Note that unlike the metacharacters ( and ), { and } are reserved words and must occur where a reserved word is permitted to be recognized. Since they do not cause a word break, they must be separated from list by whitespace or another shell metacharacter.

Új hozzászólás Aktív témák