Is it possible to exit nicely(ie, to echo a message with the error occurred) from a shell script(quiet a big one ) once it encounter an error in between the lines?
For example, in my script I am calling the command mkdir and sometimes (when the directory already exists) it fails.then i want my script to exit with the error message.Currently it passes to the next command.
I tried using the below function at the start of the script:
but calling this function after every command sounds
Can any one give me pointers on how to call this function after every command executed or someother method by which i can exit from program as soon as an error occurs...
I need a script to keep polling "receive_dir" directory till "stopfile" get written in the directory.
This has to run despite empty directory.
So far i have this but fails if receive_dir is empty with no files with "unary operator expected". Help !!
#!/usr/bin/ksh
until
do
for i... (1 Reply)
Hi,
I am writing a script in which I am using an IF-Else statement.
Code sample:
# Check for the product.
If (test "$3" = "Pet") Then
Product_Code="PI"
elif (test "$3" = "Breakdown") Then
Product_Code="RI"
elif (test "$3" = "Travel") Then
Product_Code="TI"
... (2 Replies)
I have to write a script in ksh which again should call another script. Say A.ksh is calling B.ksh. Now in B.ksh if the condition we are checking for is true then we have to go back to the main script A.ksh or if the condition in B.ksh is false then we have to totally come out of the scripts.
I... (1 Reply)
Operating System: Solaris 10, Shell
We are outputting the results of our scripts to the stderr file. However we have encountered a problem where some of the lines in the file are truncated.
Is there a way to increase the terminal or column size within the script so that this does not... (4 Replies)
/************************************************************************
*
* TEST NAME: setrlimitd_su.c
*
* PURPOSE: To verify the soft (rlim_cur) and hard (rlim_max) limit
* of process RLIMIT_DATA resources correctly inherited by
* the exec() system call.
*
* RESULT: function call should... (1 Reply)
Hi,
I am trying to exit the script from a function.
I was in assumption that if we use exit ( inside or outside the function) it will exit from the script.
alternatively, return will exit from that particular function.
but in my case, exit is exiting from the function and not the script.... (8 Replies)
Hello All,
when I install rpm
rpm --install rpm packagename
I got the following errors
stty:standard input:invalid argument
stty:standard input:invalid argument
I dont know what i have to do exactly.
I search on google for the same but not a particular standard solution is given... (17 Replies)
there are many script in my project.i am having a problem when i am trying to quit from child script.what is the command to wrap up all the parent script and calling script as well? exit 0 is not working.please help.... (1 Reply)
hi all,
i have a problem that while some of the users trying to login the following error occurs and the session is automatically closed.
ssl error: RAND_status reported there wasn't enough randomness for the PRNG.
ssl error: You need to specify RandomFile or EGDFile to obtain the randomness.... (0 Replies)