| Author |
need to return exit code
|
|
| Gregory Machin 2006-07-31, 3:57 am |
| Hi
My perl script is called by a bash script, used in a compile / build env.
But the bash script is not seeing my script's exit and is timming out and
continuing ...
How can I pass a standard exit code 0 = success 1 = fail to the operating
system / calling script.
Many Thanks
--
Gregory Machin
gregory.machin@gmail.com
www.linuxpro.co.za
| |
| Indraneel 2006-07-31, 3:57 am |
| More details might help better understanding the problem.. but i wrote
a perl script that does nothing but return with exit 0 or exit 1 and
called it from shell
sh-2.05b$ ` perl ~/test.pl`
sh-2.05b$ echo $?
1
It seems to work for me.
| |
|
| Gregory Machin wrote:
> Hi
> My perl script is called by a bash script, used in a compile / build env.
> But the bash script is not seeing my script's exit and is timming out and
> continuing ...
>
> How can I pass a standard exit code 0 = success 1 = fail to the operating
> system / calling script.
>
> Many Thanks
>
Hello,
Hope this is something you are looking for...
#!/bin/sh
echo "Call Perl Program";
perl pro.pl
val=$?;
if [[ $val == 0 ]]
then
echo "Success $val";
else
echo "Fail $val";
fi
The $? will contain the exit status of the perl program(command).
--
Prabu.M.A
When I was born I was so surprised
I didnt talk for a period and half
-Gracie Allen
| |
| JupiterHost.Net 2006-07-31, 7:09 pm |
|
Gregory Machin wrote:
> Hi
Hello,
> My perl script is called by a bash script, used in a compile / build env.
> But the bash script is not seeing my script's exit and is timming out and
> continuing ...
>
> How can I pass a standard exit code 0 = success 1 = fail to the operating
> system / calling script.
perldoc -f exit
| |
| Gregory Machin 2006-07-31, 7:09 pm |
| thanks for the support guys .. have a grate day ..
On 7/31/06, Prabu <prabu.ayyappan@gmail.com> wrote:
>
> Gregory Machin wrote:
> env.
> and
> operating
> Hello,
>
> Hope this is something you are looking for...
>
> #!/bin/sh
> echo "Call Perl Program";
> perl pro.pl
> val=$?;
> if [[ $val == 0 ]]
> then
> echo "Success $val";
> else
> echo "Fail $val";
> fi
>
> The $? will contain the exit status of the perl program(command).
>
> --
> Prabu.M.A
> When I was born I was so surprised
> I didnt talk for a period and half
> -Gracie Allen
>
>
--
Gregory Machin
gregory.machin@gmail.com
www.linuxpro.co.za
|
|
|
|