If you are making use of bash command in your script and do not want to exit the script and continue the execution, in such case you can suffix the below code to your command.
command || :
You read this as "The command or || no-operation :". By doing so the command always returns a zero (success) exit status.
Example:rm "data.csv" || :
Here the rm will not fail if the file data.csv is not found and the flow of your bash script continues.
-
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to Bash,
- Bash Hello World! Script Tutorial
- How to run bash command in background
- How to create new user account in Windows bash
- How to Compare Strings in Bash
- Bash: Allow Command to Fail without exiting Script
- Fix bash: script.sh: Permission denied Error
- Bash getopts Command Example
- How to fix bash ping command not found error
- How to add NewLine Character in Bash Script String
- How to Echo Bash Command to a File
- Bash Command to Find String in a File
- How to open new Terminal using Bash Command
- Bash How to Save Output of a Command to a Variable
- Download a SSL Certificate from a URL in Terminal
- Bash Command to Check IP Address
- Know Bash shell version command
- Bash Command To Check If File Exists
- How to run a Command in Bash Script
- How to Compare two Files in Bash Shell
- How to check if a variable is set in Bash Script or Not
- Convert String from uppercase to lowercase in Bash
- How to see Created Accessed Modified and Changed dates of a file using bash terminal command
- Bash Command To Get Current Time
- Bash command to List Files
- Fix: bash: syntax error near unexpected token
More Posts:
- Notepad++ Mark and Copy feature - NotepadPlusPlus
- What is FCM Messages Test Notification! [Microsoft Teams] [Google Hangouts] - Microsoft
- How to ignore files in git using .gitignore file - Git
- Java SE 8 Update 301 available with various bug fixes and security improvements - Java
- How to Upload Video to YouTube from Android - Android
- Java: Convert Char to ASCII - Java
- Java 8 java.util.Function and BiFunction Examples - Java
- How to SFTP to port different than 22 (SFTP Custom port) - FTP