Skip to main content

Questions tagged [error-handling]

Use this tag for questions on how to handle errors generated in shell scripts.

2 votes
1 answer
173 views

When using the set -e flag in Bash, then it's difficult to get user-friendly error messages (a stack trace) and it's difficult to add cleanup code that executes before your script exits with an error ...
user3207874's user avatar
0 votes
1 answer
101 views

bash 4.4.20(1)-release. (No portability required.) This function works great when I pass it a valid DB name: Get_ValidDB() { local pDB=$1 [ -z $pDB ] && { printf '||Requires a DB name.'...
RonJohn's user avatar
  • 1,483
1 vote
0 answers
108 views

The other day something started going wrong with the perl rename terminal command that was pre-installed on my system; which is Ubuntu 22.04.5 LTS. When I try to use any version of the rename command ...
Danae Stephens's user avatar
0 votes
0 answers
65 views

On my Linux Ubuntu system I run apache2 web server in the context of a PHP based web application. phpinfo() reports the following error_log /opt/unetlab/data/Logs/php_errors.txt I.e. error_log() is ...
CarloC's user avatar
  • 385
0 votes
0 answers
33 views

I've seen questions about this topic, but they talk about constructs like if or ||. I don't understand why the same behavior seem to happen for substitution ($())? $ my_function() { echo "the ...
Jakub Bochenski's user avatar
0 votes
1 answer
176 views

I know that set -e tells bash to exit the script on error. The problem is that I have to address the error, then delete all previous steps from the script while maintaining any variables before ...
user2013318's user avatar
1 vote
1 answer
147 views

I have a simple bash script that's supposed to create a dump file from a database docker exec -i container sh -c "mongodump --archive" > \ ~/dumps/db-$(date + "%d%m%Y").dump ...
Ambre's user avatar
  • 111
1 vote
0 answers
106 views

In Bash blocks {} and subshells () the exit early doesn't work if there is an OR condition following it. Take for example set -e { echo a; false; echo b; } || echo c prints a b and set -e { echo a; ...
QuickishFM's user avatar
0 votes
2 answers
703 views

I have a script which logs in to a server. Regardless of the success (i.e. whether the password is valid or not) the script will exit with return code 0, and the text: Error login failed. I'd like it ...
Nickotine's user avatar
  • 554
0 votes
2 answers
334 views

I am trying to use tar to recursively compress all files with the .lammpstrj extension within the directory tree starting at the directory whose path is stored in the variable home. home contains the ...
Felipe Evaristo's user avatar
1 vote
0 answers
101 views

Consider the following script: #!/bin/bash set -o errexit -o xtrace qux() { false echo QUX } quux() { qux ||: echo QUUX } quux Running this script produces: + quux ...
Azat Khabibulin's user avatar
1 vote
1 answer
486 views

I'm using parameter substitution with an error message, such as ${var1:?'some message'}. I've incorporated a multi-line error message. Presently, it only functions properly when enclosed within single ...
programmer Erfan's user avatar
0 votes
1 answer
185 views

I've had some issues with my XQuartz environment not starting due to a bit of a freak reason that was a rather hard to figure out. It's (mostly) working again but I must have caused another regression ...
RJVB's user avatar
  • 274
3 votes
1 answer
306 views

I just encountered an error where a function was missing in my script. I already trap and raise these exceptions to stop the script early, but I noticed that did not occur. Investigating this further, ...
Zhro's user avatar
  • 2,861
-5 votes
1 answer
93 views

My virtual machine stuck on this and just keep downloadin for hours please solve
muhammad wajahat ali khan's user avatar

15 30 50 per page
1
2 3 4 5
23