I use bash functions which are in different script files.
Theses scripts function files are sourced when necessary.
As function does not easily return string value, Value are return using the echo function, and a return code is returned..
Now here my question :
In the main script I want to get the error code which is 0 if every things run correctly, otherwise it is different from 0.
As in my example "function2 return always 2, I expect an error code different from 0.
But I always get 0 ( success ).
I suppose because the last function in the pipe (not_important_function_b) always success and then set the return code to 0. Even if the first part of the pipe failed.
How to catch the error from function2.
I apologize if I have already posted this query. I scanned back quite a few pages but could not find such a query.
If my perl code contains "exit(33)" how can I get that value in bash for use in a "if" statement.
Thanks,
Siegfried (5 Replies)
I have been given some pSeries AIX servers to maintain. One of the servers wont come up after a shutdown and the following code is showing on the server:
10118401
How do I look up the error code? (2 Replies)
Hello
I have a master startup script (let's call it myScript) that displays a menu from which the user can start/stop several instances of a server. When I issue the start command for one of the servers from the menu and then exit myScript through the provided mechanism (enter "q" in this case),... (2 Replies)
Hi,
I am interesting in writing the following bash codes into perl
My script is simple take field 2 in /etc/passwd and put into an array
#!/bin/bash
PASSWD_FILE=/etc/passwd
A=(`awk -F: ' { print $2 }' $PASSWD_FILE `)
Can someone give me equivalent codes in perl ? (1 Reply)
Good day,
I am trying to add signal handling capabilities to some of my scripts. Unfortunately, I am having some difficulty with the manner in which signals are propagated between parent/child processes. Consider the following example:
I have the following "parent" script:
#!/usr/bin/sh... (5 Replies)
Hi there,
I'm fairly new to bash scripting and already having some troubles. I'm making a script that can print some series of strings in colors based in the information of a file, for simplicity let's say it only does:
#!/bin/bash
printf "\eWhen you execute this in the command line it... (1 Reply)
I want to import the info to shell when the connection to remote host was closed . I have follwed by ssh errors but how to use variables in script.
I am thinking out loud the shell script could look as follow:
svnvaraible=$ERROR_SSH_CONNECTION_LOST
if ; then
break
fi (1 Reply)
Here is my daily stupid question:
How can I tell a script to only execute if the other scripts exits successfully?
So "script A" executes and it executes successfully (0),then "script B" will run
or else
"script A "executes and it exits unsucessfully (1) then "script B" will read return... (6 Replies)
Afternoon ladies and gents,
I am trying to create a simple script to remove a certain file from a user's network profile location. The removal works ok, but in the interest of overkill I would like to add a simple error detection (such as file doesn't exist or permission denied)
Currently, it... (2 Replies)