Linux & Terminali

&& and || in the shell

Në shqip: && dhe || në shell

ShpjegimiSQ

„a && b“ ekzekuton b vetëm nëse a pati sukses; „a || b“ vetëm nëse dështoi; „a ; b“ gjithmonë. Kështu shkruan „npm test && npm run deploy“ që deploy-i të mos ndodhë kurrë me teste të kuqe.

EnglishEN

“a && b” runs b only if a succeeded; “a || b” only if it failed; “a ; b” always. That's how you write “npm test && npm run deploy” so a deploy never happens with failing tests.

Si ta mendosh

Si „nëse kalon provimin, shkojmë me pushime“.

Lexoje në anglisht

Like “if you pass the exam, we go on holiday”.

Shembull kodibash

mkdir build && cd build
ping -c1 google.com || echo "S'ka internet"

Terma të lidhur