The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
1answer
15 views

How to make dd fail if it invalid skip value is specified?

When I invoke dd with an invalid value for skip it prints an error message and does nothing, but doesn't return with a value different from 0, e.g. $ cd /tmp $ mkdir xy $ cd xy $ truncate -s 2M ...
4
votes
2answers
74 views

Shell script error handling while assigning STDOUT to variable

I am trying to implement error handling in my shell script as described in the 2nd answer in Best practice to use $? in bash? My script looks like this: #!/bin/bash try() { "$@" code=$? ...
1
vote
1answer
49 views

TCL script try catch

I have a TCL script that sets a number of variables and reads several files. The last file it reads may contain sensitive information, so I need to make sure this file gets deleted even if an error ...
3
votes
3answers
111 views

why bash increment: `n=0;((n++));` return error? [duplicate]

n=0; ((n++));echo "ret=$?;n=$n;" ((n++));echo "ret=$?;n=$n;" ((n++));echo "ret=$?;n=$n;" from n=1 on, ((n++)) works correctly, only when n=0, ((n++)) return error, and I am using a trap '' ERR that ...
3
votes
0answers
30 views

Errtrace and local

I am using the following script: #!/bin/bash -Eu trap 'echo Hi' ERR exit_failure() { echo "Hello, World!" return 1 } sub_failure() { res=$(exit_failure) } sub_failure It results in the ...
3
votes
2answers
93 views

bash 'nounset' on sub-shell/child doesn't force main script to exit, how to workaround that globally?

With this script: tstNounset.sh #!/bin/bash set -x set -o nounset;set -u echo `echo $str` function FUNC1() { echo $str; };export -f FUNC1;bash -c FUNC1 function FUNC2() { set -u;echo $str; };export ...
0
votes
1answer
85 views

Using trap with ERR: How do I send $?

In bash 4.x If I have: err_handler() { echo You received error $1|mail -s "script error" MAILTO } trap err_handler ERR how do I send the actual stderr output to the function when the trap is ...
7
votes
1answer
134 views

How do I capture the exit code / handle errors correctly when using process substitution?

I have a script that parses file names into an array using the following method taken from a Q&A on SO: unset ARGS ARGID="1" while IFS= read -r -d $'\0' FILE; do ARGS[ARGID++]="$FILE" done ...
3
votes
1answer
143 views

Strange error (?) when I run `man` command from a folder that no longer exists

Let's have a look at the followings: radu@Radu:~$ mkdir test radu@Radu:~$ cd test radu@Radu:~/test$ rmdir ~/test radu@Radu:~/test$ man ls man: can't change directory to '': No such file or directory ...
3
votes
2answers
710 views

How to check whether a command such as curl completed without error?

I am using curl to upload a file to a server via an HTTP post. curl -X POST -d@myfile.txt server-URL When I manually execute this command on the command line, I get a response from the server like ...
6
votes
2answers
401 views

Making sure a command has executed in bash

I have a bash file with commands to merge pcap files. I want to know if there is anyway to make sure a line in bash runs or not. Like in windows bat file we have %ErrorLevel% ¨ Say a command touch -r ...
3
votes
1answer
755 views

chmod + silent mode + how force exit code 0 in spite of error

Is it possible execute chmod and ignore error from command Example ( remark file.txt not exsist to show the example ) When I type chmod 777 file.txt I get error on the output chmod: cannot ...
3
votes
2answers
149 views

How to implement logwatch functionality on top of systemd journal?

Logwatch scans logfiles with regular intervals, collects errors and stuff, then mails it to the admin. This was back in syslog and logfiles days. What's the corresponding solution for systemd's ...
2
votes
1answer
186 views

How to have a bash script perform a specific action on errors of _each_ command?

Similarly to set -e performs an exit on "uncaught" $? != 0, I'd like to have this event trigger the execution of another command, e.g. a logger call. How can this be done?
4
votes
2answers
609 views

How does Linux md-RAID handle disk read errors?

There are 2 cases: the read command times out at kernel level (30 seconds by default), the drive reports its unability to read a given sector before the kernel lose patience (the case I'm ...
4
votes
1answer
305 views

Bash capture any error like -e but don't exit, do something else

I want to set a flag in a shell script (bash) so that if anything returns non-zero, a flag is set (i.e. set a variable like errors="True"). So far, I've thought of calling the script with ...
1
vote
1answer
158 views

Unwanted messages every time I attempt to login?

I am using Linux Mint Olivia and it worked fine for past couple of months but from yesterday it keep showing these message whenever I want to login to my PC: Keys: Press S to skip mounting or M for ...
2
votes
2answers
77 views

Different error messages when using different strings in terminal

When I insert, for example, unix.stackexchange.com followed by Enter in terminal, I get the following error: unix.stackexchange.com: command not found This is ok and as I expected. But when I insert ...
2
votes
4answers
4k views

How to catch an error in a linux bash script?

I made the following script: # !/bin/bash # OUTPUT-COLORING red='\e[0;31m' green='\e[0;32m' NC='\e[0m' # No Color # FUNCTIONS # directoryExists - Does the directory exist? function directoryExists ...
3
votes
2answers
180 views

Getting the complete command line that caused an ERR , while trap

How do I make trap to return the command that caused an ERR? $function err_handler() { echo "$0 caused the error"; } $ trap err_handler ERR $ grep -ci "failed" test4 &>/dev/null -bash caused ...
1
vote
1answer
107 views

Detecting SSH timeout

Is there any way I could trigger a bash script when ssh times out? I have an alias to set the tmux title when starting ssh. The alias also includes a title change after the ssh session, which works ...
2
votes
3answers
349 views

Exception handling when using tail -f to monitor a log

I have a main script calling the script to do the monitoring. I am trying to catch the exception that the log is missing or not accessible anymore. tail -f is used instead of -F since the logs are ...
13
votes
4answers
3k views

How to make bash abort the execution of a script on syntax error?

To be on safe side, I'd like bash abort the execution of a script if it encounters a syntax error. To my surprise, I can't achieve this. (set -e is not enough.) Example: #!/bin/bash # Do exit on ...
7
votes
4answers
298 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? As I have little knowledge about this topic, I can vividly ...
7
votes
1answer
600 views

rsync: skip files for which I don't have permissions

I'm using rsync -rlptD to copy a directory from another user. There are a few files (I have no way of knowing these in advance) which I don't have permission to copy. Is there a way have rsync ignore ...
3
votes
3answers
225 views

Mail cron output only when Git throws a real error

There exists a Git repo that is on one server, we want to generate doxygen output for it on a different server. The following command works for me but has the downside of sending a mail everytime the ...
2
votes
3answers
2k views

Suppress server message in rsync

When I rsync or scp from a particular server I get a rather long message telling me the rules of the server. However when I setup regular pulls, I'd like to be able to suppress those messages in my ...
3
votes
1answer
1k views

Capture screen content for error parsing

I am a database administrator working with DB2 on AIX. (Please continue to read as this is related more to ksh than DB2, otherwise I would have posted this over on dba.stackexchange.com.) I am ...
1
vote
2answers
8k views

how to view php and server error logs?

I am getting the WSOD now since editing settings.php; php.ini and .htaccess trying to update my site and I need to see error logs to find out what is happening. Also how do you clear cache in command ...
2
votes
1answer
1k views

What does “DMA: Out of SW-IOMMU space” error mean?

First the link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1060268 Since this affects the kernel and other Distros, what does this type of error mean and why it happens?
1
vote
0answers
396 views

error: implicit declaration of function ‘rt_dev_socket’

The developer says: http://comments.gmane.org/gmane.linux.real-time.rtnet.user/2546 Now how can I tell the Makefile to look for headers in /usr/local/rtnet/include respectively ...
7
votes
1answer
3k views

Trap, ERR, and echoing the error line

I'm trying to create some error reporting using a Trap to call a function on all errors: Trap "_func" ERR Is it possible to get what line the ERR signal was sent from? The shell is bash. If I do ...
1
vote
3answers
1k views

Does “226 Transfer complete” guarantee the consistency between local and remote files when using ftp?

I have some automated scripts which perform FTP uploads among other things. I'm wondering what level of error checking I should conduct once these uploads have finished executing. Could anything go ...
1
vote
0answers
279 views

crossplatformui error in Mint 11

Whenever I try to install something in my system it generally installs but shows some error related to "crossplatformui". I don't know what it is and how to remove it. I am printing here a sample ...
1
vote
1answer
2k views

Unprettyfied SSL error message?

I am trying to authenticate using my USB smartcard reader to a website. I am running Ubuntu 10.04 LTS, with its most up to date Firefox browser 3.6.24. I get the following error message: Secure ...
5
votes
3answers
802 views

Crontab job not emailing on failure

I have a cron job on Debian: 1 * * * * /home/paradroid/bin/myscript.sh >/dev/null There is an installed and configured MTA, and I have received emails when the script has a syntax error, so I ...
5
votes
2answers
2k views

Is it possible to get the error message from previous command which failed when the conditional command runs using ||

I have a helper function: function error_exit { /opt/aws/bin/cfn-signal ... exit 1 } This helper function is used to signal an error. Here is an example of usage: /opt/aws/bin/cfn-init -s ...
0
votes
1answer
432 views

How to fix “number of errors while writing to disk(or) multi-zone error rate”?

I ran hard disk checker, and i found this error: Write Error Rate: number of errors while writing to disk(or) multi-zone error rate (or) flying-height --- Normalized: 200 Worst: 200 Value: ...
4
votes
2answers
12k views

Can I fix bad blocks on my hard disk with a single command?

I'm working on fixing the errors in my Hard Disk, It's possible to do that manually but it might take hours. After typing this command sudo badblocks -b 512 /dev/sda, I got hundreds of results and I ...
3
votes
2answers
6k views

What does this hard disk error message mean: “Current Pending Sector Count …”?

I grabbed this information from Disk Utillity on Linux Mint: Current Pending Sector Count: Normalized: 200 Worst: 200 Threshold: 0 Value: 22 sectors What does it mean? Is it possible to ...
11
votes
3answers
3k views

How can I pipe output to another process, but retain the error state of the first process? [duplicate]

Possible Duplicate: Get exit code of process that's piped to another I am using the following command line (in a makefile) to pipe the verbose error messages from my compiler through a ...
2
votes
3answers
25k views

how to close X Server, to avoid errors while updating nvidia driver?

I tried to update my nvidia driver but i got an error when i ran the driver installation. See the error: ERROR: You appear to be running an X server; please exit X before ...
4
votes
0answers
159 views

Repeatably generate a read error for testing? [duplicate]

I'm trying to test the error handling in some software, in particular what happens when an error occurs reading from a file or pipe. Is there a simple way to send a certain amount of data to stdout ...
3
votes
2answers
575 views

How to use $? and test to check function?

#!/bin/sh function checkExit(){ if test "$?" != "0"; then echo Command $1 exited with abnormal status exit 1; else echo $? fi } function echoThenRun () { # echo and then ...
9
votes
1answer
22k views

Where can I find a list of 'make' error codes?

I am trying to compile a program written in Fortran using make (I have a Makefile and, while in the directory containing the Makefile, I type the command $ make target, where "target" is a ...
2
votes
3answers
340 views

Are all system call error numbers unique?

I'm writing a program for Systems Programming in Unix, and one of the requirements is to process all possible error returns from system calls. So, rather than having a function tailored to each ...
4
votes
3answers
2k views

Best practice to use $? in bash?

When I read this answer about $? another question comes to mind. Is there any best practice for how to use $? in bash? Let's have a example: We have a linear script and I we would like to know ...
4
votes
4answers
2k views

Understand error codes in Linux

I am working on Linux (Kernel Version 2.6.32.28) laptop. After I inserted/did file io/removed a SD combo card, I got following errors: mmcblk0: error -123 sending status command mmcblk0: error ...
5
votes
1answer
284 views

What is Linux for VMS DCL “ON ERROR”?

Using VMS DCL command scripts one can catch errors by using the on error command: $ on error then goto MyErrorHandler $ directory samiam.txt $ delete x.txt $ exit $MyErrorHandler: $ print ...