Cookie Consent by Free Privacy Policy Generator ๐Ÿ“Œ YSK: You usually should use "&&" instead of ";" in Bash

๐Ÿ  Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeitrรคge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden รœberblick รผber die wichtigsten Aspekte der IT-Sicherheit in einer sich stรคndig verรคndernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch รผbersetzen, erst Englisch auswรคhlen dann wieder Deutsch!

Google Android Playstore Download Button fรผr Team IT Security



๐Ÿ“š YSK: You usually should use "&&" instead of ";" in Bash


๐Ÿ’ก Newskategorie: Linux Tipps
๐Ÿ”— Quelle: reddit.com

The idea behind both of these is to run commands one after another, but there is one subtle difference: ; will run the second command immediately after the first one returns, but && will only run the second one if and only if the first command returns 0 (success). Returning anything else or crashing will result in the second command not being run. Note that a line break (\n) is the same as using ; in Bash.

Here's an example: Let's say you are cloning a Git repository, then installing the software. So the goal is to run git clone https://www.github.com/NateNate60/myrepo, then run cd myrepo, and then make and make install. Simple enough. A naive script:

git clone https://www.github.com/NateNate60/myrepo cd myrepo make make install 

...or the one-liner:

git clone https://www.github.com/NateNate60/myrepo; cd myrepo; make; make install 

Both of these will usually work, but the second command onward is only valid if the git clone succeeds! Otherwise, ./myrepo will not exist, so cd will fail, and then the Bash will end up running make and make install on the current directory.

Note that there is a double-whammy in the naive script; make install is only valid if make works! So if compilation fails, and the makefile is either misconfigured or worse, you could end up installing junk.

So if you're smart and you know your stuff about Bash, you would instead write:

git clone https://www.github.com/NateNate60/myrepo && \ cd myrepo && \ make && make install 

...or maybe you'd store the return value and intelligently report an error to the user :)

submitted by /u/NateNate60
[link] [comments] ...



๐Ÿ“Œ YSK: You usually should use "&&" instead of ";" in Bash


๐Ÿ“ˆ 109.16 Punkte

๐Ÿ“Œ YSK : Do not use 'sudo vim/nano/emacs..' to edit a file. Instead, set your $EDITOR and use sudoedit or sudo -e.


๐Ÿ“ˆ 53.92 Punkte

๐Ÿ“Œ Neu im TV und bei Sky: "Suits", "Das Boot", "Better Call Saul" und "What We Do in the Shadows"


๐Ÿ“ˆ 34.89 Punkte

๐Ÿ“Œ Samsung-Geheimsprache geknackt: Das bedeuten "Water", "Merlot", "Wise" und "Fresh"


๐Ÿ“ˆ 34.89 Punkte

๐Ÿ“Œ niieani/bash-oo-framework: Bash Infinity is a modern boilerplate / framework / standard library for bash


๐Ÿ“ˆ 32.34 Punkte

๐Ÿ“Œ Bash Scripting - BASH Scripts For Heavy Commandline Users [Bash Snippets]


๐Ÿ“ˆ 32.34 Punkte

๐Ÿ“Œ Bash Scripting - BASH Scripts For Heavy Commandline Users [Bash Snippets]


๐Ÿ“ˆ 32.34 Punkte

๐Ÿ“Œ Back to bash: Inception, running bash inside bash


๐Ÿ“ˆ 32.34 Punkte

๐Ÿ“Œ YSK this YouTube channel which shows in a glance new and updated distros.


๐Ÿ“ˆ 31.92 Punkte

๐Ÿ“Œ Die Kino-Flaute geht weiter: "Top Gun", "Avatar", Mulan" und "Spider-Man" werden verschoben


๐Ÿ“ˆ 30.53 Punkte

๐Ÿ“Œ Netflix: "Es", "Daddy ohne Plan" und "All I See Is You" fliegen aus dem Programm


๐Ÿ“ˆ 30.1 Punkte

๐Ÿ“Œ Neu bei Amazon Prime Video im April: "Bibi & Tina" "Tales from the Loop" und "Falling Snow" starten


๐Ÿ“ˆ 29.22 Punkte

๐Ÿ“Œ "The Batman", "Avatar", "The Witcher" & Co.: Die Dreharbeiten gehen nach Corona-Pause wieder weiter!


๐Ÿ“ˆ 29.22 Punkte

๐Ÿ“Œ Super Bowl 2024: "Deadpool & Wolverine", "Planet der Affen", "Wicked" und mehr - alle neuen Film-Trailer


๐Ÿ“ˆ 29.22 Punkte

๐Ÿ“Œ You probably hate systemd because you think it's all about "boot fast no bash" - but it can do so much more you probably had no idea about.


๐Ÿ“ˆ 28.24 Punkte

๐Ÿ“Œ Why does macOS Catalina use Zsh instead of Bash? Licensing


๐Ÿ“ˆ 28.18 Punkte

๐Ÿ“Œ Should you use Buy Now, Pay Later instead of a 0% APR credit card offer?


๐Ÿ“ˆ 28.16 Punkte

๐Ÿ“Œ Why you should ditch VSCode, and use Neovim instead.


๐Ÿ“ˆ 28.16 Punkte

๐Ÿ“Œ Crypto Tips For Beginners: Why You Should Use An Exchange Instead Of A Wallet


๐Ÿ“ˆ 28.16 Punkte

๐Ÿ“Œ Another reason why one should never use curl | bash: "An Untrustworthy TLS Certificate in Browsers", by Bruce Schneier


๐Ÿ“ˆ 27.88 Punkte

๐Ÿ“Œ The malware that usually installs ransomware and you need to remove right away


๐Ÿ“ˆ 27.85 Punkte

๐Ÿ“Œ Mit Stars aus "Game of Thrones" und "Stranger Things": Verlosung zu "The New Mutants"


๐Ÿ“ˆ 26.17 Punkte

๐Ÿ“Œ "Beziehung" oder "nichts Ernstes": Tinder fรผhrt "Relationship Goals" ein


๐Ÿ“ˆ 26.17 Punkte

๐Ÿ“Œ "Im Westen nichts Neues", "Platoon", "WarGames" und Co.: Das sind die spektakulรคrsten Kriegsfilme!


๐Ÿ“ˆ 26.17 Punkte

๐Ÿ“Œ Cannes 2024: "Furiosa", "Joker 2", "Gladiator 2" und Co. - Mรถgliche Blockbuster auf dem Filmfestival


๐Ÿ“ˆ 26.17 Punkte











matomo