Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Linux shell | how to exit a script if any command fails. Post 302977781 by RudiC on Friday 22nd of July 2016 05:42:51 AM
Old 07-22-2016
On top of what already has been said, please tell us if your operation should be "atomic" or not, i.e. if any name creation fails, should then all 3 names be discarded? Or would it be sort of "position dependent", like: if name1 fails, don't create any further name, but if name3 fails, leave name1 and name2 intact?
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

using exit command in a shell script

Can it be done? If so, how? I would like a script to contain the exit command, and log me off at script completion. thanks (1 Reply)
Discussion started by: jpprial
1 Replies

2. Shell Programming and Scripting

How to print error and exit if command fails?

Guys any tips on printing a certain error message to stderr and exiting should a command fail within a ksh script? I'm trying to null some output files. Touch isn't suitable as i need to null them. print "" > file isn't suitable as i need to check elsehere for if they are 0bytes or not. ... (5 Replies)
Discussion started by: lavascript
5 Replies

3. Shell Programming and Scripting

problem in exit status of the command in a shell script-FTP

Hi All, I have developed below script for FTP a file from unix machine to another machine. ftpToABC () { USER='xyz' PASSWD='abc' echo "open xx.yy.zbx.aaa user $USER $PASSWD binary echo "put $1 abc.txt" >> /home/tmp/ftp.$$ echo "quit" >> /home/tmp/ftp.$$ ftp -ivn <... (3 Replies)
Discussion started by: RSC1985
3 Replies

4. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

5. Shell Programming and Scripting

store last command exit status in variable in shell script

Hello All My req is to store the exit status of a command in shell variable I want to check whether the file has header or not The header will contain the string DATA_ACQ_CYC_CNTL_ID So I am running the command head -1 $i | grep DATA_ACQ_CYC_CNTL_ID Now I have to check if... (6 Replies)
Discussion started by: Pratik4891
6 Replies

6. Shell Programming and Scripting

How to exit a shell script if a unix command does not return any value for 10 seconds?

Hi, Can anyone help me how to exit a shell script if a unix command inside does not return any value for 10 seconds? The scenarios is like this. I want to login to a application using shell script where the connection string is mentioned.but suppose this connection string is not... (10 Replies)
Discussion started by: arijitsaha
10 Replies

7. Shell Programming and Scripting

How to exit from shell script if above condition fails?

HI cd ${back_home} if above back_home does not exist, then script shoul exit. Please let us know how to do that (7 Replies)
Discussion started by: buzzme
7 Replies

8. Shell Programming and Scripting

Executing 'exit' command from shell script

Hi, I am writing shell script to automate few use cases for CLI interface. We have CLI interface which has bunch of commands. I am trying to execute one of the commands 'exit' as part of automation to exit from CLI object (not from shell script) in my shell script. My intension is to execute... (4 Replies)
Discussion started by: Mahesh Desai
4 Replies

9. Shell Programming and Scripting

Find command works on Linux but fails on Solaris.

Hi, I am looking for a generic find command that works on both Linux and Solaris. I have the below command that works fine on Linux but fails on solaris.find /web/config -type f '(' -name '*.txt' -or -name '*.xml' -name '*.pro' ')' Fails on SunOS mysolaris 5.10 Generic_150400-61 sun4v sparc... (1 Reply)
Discussion started by: mohtashims
1 Replies

10. Shell Programming and Scripting

Replace string works on command-line but fails when run from shell script

I wish to replace "\\n" with a single white space. The below does the job on command-line: $ echo '/fin/app/scripts\\n/fin/app/01/sql' | sed -e 's#\\\\n# #g'; /fin/app/scripts /fin/app/01/sql However, when i have the same code to a shell script it is not able to get me the same output:... (8 Replies)
Discussion started by: mohtashims
8 Replies
SHAPE_PATCH(1)						      General Commands Manual						    SHAPE_PATCH(1)

NAME
shape_patch - shapeTools RMS generate patch file SYNOPSIS
shape patch OLDRELEASE=<name1> NEWRELEASE=<name2> [PATCHFILE=<filename>] DESCRIPTION
Shape patch generates a patch file for updating $(OLDRELEASE) to $(NEWRELEASE). Both releases are identified by release names associated with the macros OLD-/NEWRELEASE on the command line. Valid release names are those generated by any of the shape_RMS (pre-)release building procedures (see shape_releas(1)). Performing 'vl -all' with the release identification file as argument usually gives a good overview of existing release names. Patch generation happens recursively over all subsystems being part of the current node. Hence, triggering shape patch from the top node of the central source repository creates a patch file for the whole system. The output of shape patch is stored in a file named <name1>+2+<name2>.pat. When the PATCHFILE macro is set on the command line, $(PATCH- FILE) is taken as output file name instead. Defining PATCHFILE=- on the command line causes the patch to be written to standard output. Note: For patches invoking multiple subsystems, $(PATCHFILE) should be set to an absolute pathname. If not, the patch generation procedure will leave an equally named patch file for each visited subsystem. The patch is constructed using the vdiff(1) command and can be applied to any installation of $(OLDRELEASE) by invoking patch(1). INCONVENIENCES
On System V machines, the generated patch file name will almost certainly exceed the 14 characters filename length limit. SEE ALSO
shape_releas(1), vdiff(1), patch(1) FILES
<name1>+2+<name2>.pat 28.9.119 SHAPE_PATCH(1)
All times are GMT -4. The time now is 09:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy