File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
reference/7/Microsoft.PowerShell.Core/About Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,9 @@ npm run build && npm run deploy
34
34
The ` && ` operator will execute the right-hand pipeline,
35
35
if the left-hand pipeline succeeded,
36
36
whereas the ` || ` operator will execute the right-hand pipeline
37
- if the left-hand pipeline failed:
37
+ if the left-hand pipeline failed.
38
+
39
+ #### Two successful commands
38
40
39
41
``` powershell
40
42
Write-Output 'First' && Write-Output 'Second'
45
47
Second
46
48
```
47
49
50
+ #### First command fails, causing second not to be executed
51
+
48
52
``` powershell
49
53
Write-Error 'Bad' && Write-Output 'Second'
50
54
```
@@ -55,6 +59,8 @@ Write-Error 'Bad' && Write-Output 'Second' : Bad
55
59
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException
56
60
```
57
61
62
+ #### First command succeeds, so ` || ` means second command not executed
63
+
58
64
``` powershell
59
65
Write-Output 'First' || Write-Output 'Second'
60
66
```
@@ -63,6 +69,8 @@ Write-Output 'First' || Write-Output 'Second'
63
69
First
64
70
```
65
71
72
+ #### First command fails, so ` || ` means second command is executed
73
+
66
74
``` powershell
67
75
Write-Error 'Bad' || Write-Output 'Second'
68
76
```
You can’t perform that action at this time.
0 commit comments