Questions tagged [exit-code]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
2answers
45 views

Exit Code history and best practice

I am finding a bunch of duplicate error codes when dealing with Autodesk installs and uninstalls. For example 3010 ERROR_SUCCESS_REBOOT_REQUIRED -2147021886 ERROR_SUCCESS_REBOOT_REQUIRED and 1618 ...
0
votes
0answers
26 views

fish shell - run command based on exit status of previous command

My goal is to have a monitor setup, that is as flexible and easy to use as possible. I use fish as my shell and have added the following two lines: abbr mon 'xrandr --output DP2 --auto --primary --...
0
votes
0answers
8 views

HTCondor refuses to start any sub-daemons

I have successfully installed HTCondor on the master node and this allows job submission, however the job sits in the queue. I followed the same approach to install HTCondor on the first node, but ...
4
votes
1answer
316 views

How to exit with an error code from nano?

When using vim for “replying” to some program – typically git – it can be useful to deliberate exit with error, to abort the entire action that opened the window. Like $ git commit -a # vim opens, ...
6
votes
1answer
407 views

Use output of command as exit code

For my Continuous Integration scripts I want to check if the git branch is not in sync with the master branch. Therefore I use git rev-list --left-right --count master...my-branch-name It will ...
1
vote
0answers
87 views

How to get exit code of a subprocess?

So, I have process B. Typically, process B is called and ran entirely with the context of process A. Unfortunately, for some reason, process B has stopped running properly when called by A, but it ...
0
votes
2answers
2k views

a bash pipe command exit code rule

I was writing a simple script that checks the output of a command that if it displays a certain keyword. To see if it works, I was checking the command from the bash command line. $ ls | grep -q ...
0
votes
1answer
2k views

What does exit status 1 (0x1) mean for a Windows GUI program?

I have recurring occurrences of Internet Explorer (C:\Program Files\Internet Explorer\iexplore.exe) exiting with exit status 1 (0x1) in my Windows Eventlogs (event id 4689). Whenever I google for the ...
2
votes
1answer
616 views

why doesn't “echo $?” print the exit code of the command right before it while used in “&&”?

Suppose I have this simple C program that returns 4 to the shell. int main() { return 4; } When I run it, then do echo $?, I would get 4, which is expected $ gcc foo.c && ./a.out $ echo $?...
-1
votes
2answers
956 views

Echo for status codes?

I'm looking for a tool like echo, but for status codes $ sts 120 $ echo $? 120 I know you can use a sub-shell in a bash-like environment: $ (exit 120) $ echo $? 120 but is there a way to do such ...
2
votes
3answers
5k views

Exit code 127 in cygwin64

After years without problems, suddenly several programs in my installation of cygwin64 on 64-bit Windows 7 Professional are failing to run, and instead appear to exit immediately with code 127, which ...
3
votes
2answers
3k views

What's the exit code for “curl -I” when not HTTP 200?

I want to check what HTTP status code is returned for an HTTP(S) URL. I don't care about content, so I just request head with curl -I $url or curl --head $url But what's the exit code I should ...
0
votes
1answer
739 views

Exit status of commands before last command

On OS X, Linux, and other systems, you can use $? to get the exit code of the last command. Is there any way to exit codes of older commands? Either by saying "give me the exit code of the nth ...
1
vote
0answers
46 views

Simulating errorlevel

My command takes long to run but I expect that it can finish with error and I want fail fast in the batch loop in this case. How do I produce the error level? I tried a batch file with exit 1. But, ...
0
votes
1answer
153 views

Check shell Script copy Status

I have a cron script and i need to adjust it; Actually some clients are generating in a directory some files, my task is to backup that files to a tape, and i need to make a if then else cp $files $...
1
vote
3answers
97 views

How to find files which do not contain their own filename

When using templates to generate files, it's important to include the template's name inside the template. When reading a generated file, it helps you find the template used to generate it. I want to ...
0
votes
1answer
3k views

How do I run multiple scripts within a script, even if one script fails

I have a simple bash script that executes a number of other scripts … #/bin/bash … ./update_artifact1.sh $ARTIFACT_VERSION ./update_artifact2.sh $ARTIFACT_VERSION ./update_artifact3.sh $...
6
votes
3answers
5k views

How do you use PIPESTATUS, tee and /bin/sh together?

When I run curl | tee test.txt; echo ${PIPESTATUS[0]} I correctly see curl: try 'curl --help' or 'curl --manual' for more information 2 But when I try to run exactly same command using '/...
1
vote
1answer
625 views

trying to install windows hotfix, but getting a negative exit code

I am trying to install windows-8-RT kb2771744 hotfix. I am getting a negative exit code: -2125124329 I converted that into hex: 7FDBFFE9 I looked around, I am not sure what to make of it.
216
votes
3answers
94k views

Can I make cURL fail with an exitCode different than 0 if the HTTP status code is not 200?

I was always assuming that when curl got an HTTP 500 response it was returning an exit code that meant failure (!= 0), but that seems to be not the case. Is there a way I can I make cURL fail with an ...
1
vote
1answer
1k views

Get errorlevel in cmd script calling ssh

ssh -i private_linux_key user@machine "exit 1" || echo %errorlevel% This always prints 0. How can I get actual error code returned by ssh? || somehow detects that there was an error.
8
votes
4answers
6k views

Accessing an exit code outside of a su -m $USER -c “<cmd>”

The below command prints "0" or "1" correctly depending on failure or not because i put $? inside the "su" command. sudo su -m $USER -c "./shutdown.sh &> /dev/null; echo \$?" However, if i do ...
4
votes
1answer
2k views

How do I invert the exit code of a program or pipe within ZSH?

I want to invert the exit code of a piped command sequence: foo | bar within the ZSH. So 0 maps to 1 and 1-128 maps to 0.
3
votes
2answers
12k views

exit code 128, what's the reason?

As per definition exit code 128 means 'invalid exit argument'. But i always get 255 (Exit status out of range) in case argument is invalid like float number. Is this the proprietary implementation ...
36
votes
2answers
13k views

Can I make SSH fail when a port forwarding fails?

If I do a remote port forward, a la -R 3690:localhost:3690 when a binding already exists on the port on the remote host, I get this warning: Warning: remote port forwarding failed for listen port ...
14
votes
2answers
8k views

How to make TaskScheduler fail when the task returns result different from 0

I have a backup task that fails with a non zero result, yet Task Scheduler says that it executed the task correctly. Is there any way to tell Task Scheduler that the task failed?
118
votes
10answers
83k views

Getting ROBOCOPY to return a “proper” exit code?

Is it possible to ask ROBOCOPY to exit with an exit code that indicates success or failure? I am using ROBOCOPY as part of my TeamCity build configurations, and having to add a step to just silence ...
1
vote
1answer
1k views

How to check return status of command invoked from command line in windows?

reg import RegFile.reg How to check return code of this command ?