Questions tagged [error-handling]

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

0
votes
1answer
67 views

get an error typeset: not found when i launch my script by crontab?

I use this portion of code to set default values in my config on my script.sh # Copyright (c) 2015 # Licence MIT ( http://choosealicense.com/licenses/mit/ ). #!/bin/sh typeset -A config # init ...
1
vote
1answer
78 views

Shell script error to extract file data

I have attempted to write a shell script and it is giving an error which I cannot understand. The script goes like this: #!/bin/bash while read id do cat demuxR1/$id.barcode.in.R1.R1.fastq demuxR2/$...
0
votes
1answer
305 views

tar returns error but still unpacks file even though “tar --no-ignore-command-error -xvzf file.tar.gz” is used

I have a corrupted file called file.tar.gz and I want to the extraction of it to fail. I used tar --no-ignore-command-error -xvzf file.tar.gz but it still extracting the files, and ignoring the errors:...
1
vote
1answer
1k views

Well Behaved Non-Zero Exit Codes?

It's my understanding that a unix shell shell script can, and should, issue an exit code. An exit code of zero means the program completed successfully, while a positive integer exit code (1-255) ...
0
votes
1answer
3k views

What exactly does “Illegal instruction (core dumped)” mean? [duplicate]

I see a lot of solutions to resolving the problem exemplified by Illegal instruction (core dumped) But, I'm wondering what exactly that means? What generates that error, and what's the root cause ...
0
votes
1answer
74 views

The /bin/ prefix to kill command is getting rid of the error message

I have Debian Stretch.. I thought that a regular user could kill root process as root. I was using the command /bin/kill 10733 as the user. There wasn't any error message. Then, I typed out the ...
1
vote
1answer
454 views

Makefile: Copy using make variables --> error; Not so without variables!

In the following makefile InputLocation:=./Test OutputLocation:=$(InputLocation)/Output Input:=$(wildcard $(InputLocation)/*.md) Output:=$(patsubst $(InputLocation)/%, $(OutputLocation)/%, $(Input:...
1
vote
0answers
52 views

Scribbleton doesn't run on Linux Mint 19

I am trying to install and run Scribbleton on Linux Mint 19, but when I do ./run_scribbleton.sh nothing happens. Talking to the support, they asked me to modify the run_scribbleton.sh script to print ...
1
vote
0answers
199 views

I am getting this errror when trying to install the newest version of Python 3. Any ideas on how to fix it?

checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for python3.7... no checking for python3... python3 checking for --enable-universalsdk... no ...
4
votes
1answer
282 views

Weird problem with Dwarf Fortress install

Here's the thing. I'm running Mint 19, relatively fresh install. I heard a lot of hype about Dwarf Fortress, and installed it once; then, needing to leave in a hurry, closed it with Control-C. Ever ...
1
vote
0answers
55 views

Ubuntu 17.10 unmet dependencies error and unable to open apps including terminal [closed]

Okay, I have had this error for probably over 6 months and finally after being so lazy to do so am trying to get an answer to fix my problem. One day, doing absolutely nothing to screw up my Ubuntu, ...
0
votes
3answers
665 views

Upgrade from fedora 25 to 27 - Conflict issue

I tried to upgrade from fedora 25 to fedora 27. When running sudo dnf system-upgrade download --releasever=27 --allowerasing I encountered a transaction check error regarding python. The error ...
2
votes
1answer
2k views

how to locally redefine 'command_not_found_handle'?

I'd like to make a particular bash script failfast when it cannot find a command, while retaining globally the usual friendly command_not_found behavior. E.g., if I save the following to /tmp/foo.sh, ....
7
votes
2answers
14k views

What does ESRCH mean?

Out of: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html It's always pretty clear why an errno code is named a particular way except for this one. How does SRCH relate to No such ...
7
votes
4answers
596 views

Which data should be excluded from log files , error messages etc. if posted online?

What data should one erase from log files, error messages etc., if posting them as a screenshot so as not to expose sensitive information? To narrow down my question: What should a Linux User be ...
0
votes
1answer
293 views

error: duplicated database entry using pacman [duplicate]

I issue $ pacman -Su :: Starting full system upgrade... error: duplicated database entry 'python2-cairo' there is nothing to do So I have a look at /var/lib/pacman/local $ ls /var/lib/pacman/local/...
2
votes
1answer
85 views

Script error handling: need to report segfault in script run by ssh

I wrote a cron job, which uses ssh to run a script on a server. I just tried running the script, and now I am unhappy. client# ssh server.local /usr/local/bin/script client# server# /usr/local/bin/...
-2
votes
1answer
125 views

Using the ping command on my VirtualBox Debian System returns no route but I can still connect to websites

For further clarification, I'm using a bridged adapter on VirtualBox and it's set to allow VMs (it is also using the correct adapter). This is what the terminal responds with after running the ...
1
vote
1answer
123 views

How to silently handle the “bash: /xyz: Is a directory” error in bash shell?

In zsh, executing the directory path will cd into it. I want to make bash shell to behave the same. The idea is to check and see if the error is bash: /xyz: Is a directory and cd into '/xyz' and ...
1
vote
2answers
4k views

Random firmware error after update on my Kali system

Well, isn't that just terrific. After updating my system (Kali GNU/Linux 2018.1 variation, to be specific), I got the following message on boot: [ 14.146398] platform regulatory.0: firmware: failed ...
-2
votes
1answer
209 views

How to verify that the installation of Apache Server works?

Debian 9.5 Apache HTTP Server 2.4.34 (httpd) After installing Apache from the official page with sudo make install, I want to check that the installation works starting the server: $ sudo /usr/local/...
2
votes
1answer
223 views

Getting error code of the first command in pipe in ash

I use wget to download a big file to two FIFOs like that: wget <wget-args> -O - | tee -a "$fifo1" >> "$fifo2" I want to retrieve the error code of wget on failure. set -o pipefail ...
0
votes
2answers
66 views

How do I make this script output: “Error connecting to Mom via SSH” when connection is down?

Intention I am in the middle of writing a little shell script (POSIX, except for the system_beep()). The script, which runs in Cygwin, should find out, if my mother's laptop is closed or not and ...
2
votes
1answer
232 views

Has anyone tried to write a shell that fixes errexit (`set -e`)?

errexit (set -e) is often suggested as a way to make simple scripts more robust. However, it is generally regarded as a horrible trap by anyone who has seen how it behaves in more complex scripts, in ...
1
vote
0answers
1k views

“unexpected EOF while looking for matching `)'” - when trying autocomplete [duplicate]

Whenever I start typing in a command which uses $( ) expansion, and I press tab while typing in the inner command, I get an error: unexpected EOF while looking for matching `)' Thus, for example, I ...
1
vote
0answers
61 views

Why does trying to open a sub-shell in a for loop give a syntax error at done?

If I execute this bash script: #!/bin/bash j=0 for(( i=1;i<(j);i++ )) do echo j done I get: ./test: line 6: syntax error near unexpected token `newline' ./test: line 6: `done' I know that the ...
0
votes
2answers
268 views

How to make systemd not hang (unresponsive system), but provide emergency shell?

I am not very familiar with systemd. The answer I seek with this question is: How is it possible to make systemd react to problems with "dropping the user into an emergency shell of sorts", instead ...
1
vote
1answer
54 views

Does we need a delay time between command in Linux ?

I have a script process.csh for processing many files through many steps which the above output is the input of below command. Do I need to insert a delay between commands to be sure there is no ...
2
votes
1answer
399 views

Trap and collect script output, “input file is output file” error?

I need to upload the output of the current script, so I added a trap and set -ex, e.g #!/bin/bash exec &> /tmp/error.log trap 'cat /tmp/error.log; curl http://127.0.0.1/error.php?hostname=$(...
1
vote
2answers
51 views

Redirect all lines of code to the same file in a single line

I have the following command set used to update all my WordPress sites in my CentOs shared-hosting partition on my hosting provider's platform (via daily cron). The wp commands inside the pushd-popd ...
1
vote
0answers
2k views

the 'grub-efi-amd64-signed' package failed to install into /target/

I am trying to install Ubuntu 18.04 but I get this error at the end of installation process! I tried to create a partition with ext4 for \boot. also ext1 but non of them worked. Also I tried to ...
5
votes
2answers
4k views

Why to set errno to zero at the time of initialization of the program and can't test it before error occurred? [closed]

I am reading the material available on errno variable of <errno.h> header file. I read : " A value of 0 indicates that there is no error in the program." and "As a good practice, developer ...
24
votes
5answers
20k views

Prevent grep from exiting in case of nomatch

This script does not echo "after": #!/bin/bash -e echo "before" echo "anything" | grep e # it would if I searched for 'y' instead echo "after" exit It also would if I removed the -e option on the ...
11
votes
1answer
203 views

How can I test my shell script's file-handling robustness?

I've written a shell script that handles some "regular" filenames, but I've read Why does my shell script choke on whitespace or other special characters? and Why you shouldn't parse the output of ls ...
3
votes
1answer
76 views

Warn in crontab if command has failed multiple consecutive times

I have a command in my crontab to monitor a service (specifically, check whether the Tor version of my website can still be accessed): this monitoring command succeeds if it can access the site, and ...
0
votes
3answers
40 views

How can I limit the number of error messsages displayed after compiling a C++ program?

I am compiling a C++ program with g++ and each time get a huge number of errors, forcing me to scroll up every time I want to view the first (and most relevant) error. I am wondering if there is an ...
-2
votes
1answer
6k views

apt-get update Kali Linux error [duplicate]

I tried updating with apt-get update && apt-get upgrade as well as with apt-get update --fix-missing and apt apt-get clean && apt-get update && apt-get dist-upgrade but it ...
0
votes
0answers
58 views

How to filter out warning messages from yum?

I have installed via yum some packages as follows: $ yum install ambari-agent During installation there are a lot of warnings (see below). Is it possible to block these warnings but see only the ...
4
votes
2answers
1k views

Suppress all output in yum except for errors

In yum when you do an update with yum update you normally get all success and error messages output on the CLI. Is there any way to have yum suppress all successful package installations and only ...
-2
votes
1answer
261 views

Redirect the error to /dev/null [closed]

I have a shell script with the line COMPRESS_OPTION=`which compress` There is no compress utility installed in our server, hence it gives the error which: no compress in (/usr/local/bin:/bin:/usr/...
0
votes
0answers
40 views

Variable expansion succeeds with echo but fails without a command (execution by expansion) [duplicate]

I created a file nano ~/uncwe/configurations/variables.sh. This file contains: set -a rse="~/${repo}/internal_software/rse.sh" set +a I sourced the file, then tried to execute: ${rse} bash ${rse} ...
4
votes
1answer
3k views

Show error message if bash script terminates due to set -e

I want to terminate script if any command returns nonzero value, what I achieved by adding set -e. Now script fails on encountering problems (what is desirable) but it is easy to miss it - some ...
0
votes
4answers
1k views

/bin/sh returns 0 when it did not find a command in an if statement, is that expected?

I wrote a C++ watchdog that runs a set of scripts to determine whether there is a problem on that system. The code is a bit hairy so I won't show it here, but it is equivalent to a system call as ...
0
votes
1answer
1k views

Can't boot after updating OS update on CentOS 7

I'm using CentOS 7 with gnome UI After I use software update tool and install&restart the OS update it can't boot, it can go through the pass phase for the disk but keep spinning and can't access ...
0
votes
1answer
305 views

How to add set -e to all default bashes?

To make a bash script exit after any failed command, you can add set -e Imagine, you have a CI agent which allow people to embed bash scripts as tasks in build jobs. How to make the exit ...
6
votes
1answer
2k views

bash: Accessing function call stack in trap function

Working on a bash function call stack trace... Script traps errors and runs a callStack() function. But on trapping, It always shows a call stack for the callStack() function itself instead of the ...
0
votes
1answer
1k views

Concalc - “tcsetattr error: Inappropriate ioctl for device”

In a bash script I use the following: #!/bin/bash calc=$(concalc "$*") printf "%s\n" "$calc" I do get the result I want, but allways with this error message: tcsetattr error: Inappropriate ioctl ...
1
vote
0answers
2k views

Repeated error : #error “Only <glib.h> can be included directly.”

I have a research on author attribution compression distance. And I should use "Complearn" ,which is a compression program, in my work. But in the beginning I have problem in installing this program. ...
0
votes
1answer
313 views

How to resolve [1]+ Exit 1 error?

I want to run four different R codes on linux batch using the following command: nohup R CMD BATCH code_name.R& I could run 2 of the codes on background, but running the other two codes, I get ...
0
votes
1answer
274 views

crontab error with installation

I have a problem to install cron task on debian server. It was working on my mint station, but when I implement it to crontab and try to install it, it is not working. Can you help me please? User ...