The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
12 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
30 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 ...
0
votes
0answers
218 views

Wrong exit status from expect script

I developed the TELNET_TEST.expect (expect script ) in order to test TELENT connection on remote machine this script perform telnet on target machine wait for login and send password and make exit ...
1
vote
0answers
13 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
0answers
23 views

How to save a document and close it after the save

Currently I have a .bat file that opens a program, opens a document and then reloads this document so it contains new data. After that I need a timeout so it can run some other things within the ...
0
votes
1answer
62 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
2answers
49 views

How to find files which do not contain their own filename

When using templates to generating 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 ...
0
votes
1answer
328 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 ...
1
vote
2answers
544 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
0answers
85 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.
16
votes
2answers
5k 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 ...
0
votes
1answer
468 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.
2
votes
4answers
2k 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 ...
1
vote
1answer
581 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.
2
votes
2answers
3k 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 ...
14
votes
2answers
2k 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 ...
4
votes
1answer
2k 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?
38
votes
7answers
23k 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
579 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 ?