linux:bash

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:bash [2026/01/10 14:59] – [Control Operators] mhlinux:bash [2026/01/11 11:57] (current) – [Control Operators] mh
Line 142: Line 142:
 It’s about acknowledging expected non-problems. It’s about acknowledging expected non-problems.
  
 +----
 +
 +=== && AND Operator ===
 +
 +This control operator tells bash to run a second command **only if the first command before it succeeded**.
 +
 +If the first command fails, the second command is entirely skipped.
 +
 +**Example**
 +<code bash>
 +$ rm hello.txt && echo "Deleted file."
 +rm: cannot remove 'hello.txt': No such file or directory
 +</code>
 +
 +Because the file did not exist, the ''echo'' command was not run.
 ===== Arguments ===== ===== Arguments =====
  
  • linux/bash.1768053580.txt.gz
  • Last modified: 2026/01/10 14:59
  • by mh