Sponsored Content
Top Forums Programming Shell programming ksh AIX - beginner Post 302609245 by gary_w on Monday 19th of March 2012 12:56:41 PM
Old 03-19-2012
Here is a basic framework for what you are trying to do.

script1:
Code:
#!/bin/ksh

integer rc  # Holds return code.

# Call script 2.  When its done, the shell variable $? will contain its return code
# (the return code from the previous command run). In this case you can set it 
# yourself in script2.
script2
rc=$?  # Save the return code from script2
if (( $rc != 0 )); then  # If return code is non-zero, failure
  print "script2 failed"
else
  print "script2 succeeded"
fi
exit 0

script2:
Code:
#!/bin/ksh
integer rc  # Holds return code
<some command>
rc=$?
if (( $rc != 0 )); then
  exit 1   # Exit 1 if the command fails.  Whoever calls this script can capture and
             # test this return value.
fi
exit 0

 

10 More Discussions You Might Find Interesting

1. AIX

Aix Shell Programming

HI I am trying to write a shell script which accepts two strings from user and finds the matching number of characters in those two ex: string 1 abcd string 2 bcgt result is bc (matching characters) pls provide me with a basic script for doing that (1 Reply)
Discussion started by: akmtcs
1 Replies

2. Shell Programming and Scripting

sed not working on AIX in ksh shell!

Hi All, I have this script which doesn't work on AIX ksh shell.. # ! /usr/bin/ksh grep -irl "6000" /home/applmgr/xyz > file_list_port.log xargs sed -i 's/6000/6010/g' < file_list_port.log But this same script has worked perfectly on linux bash shell.. Could anyone please share... (4 Replies)
Discussion started by: a1_win
4 Replies

3. Shell Programming and Scripting

Beginner Shell Programming Question

Hello all, I am currently try to learn the linux operating system as well as some bash programming. I have come across some online course work which has been very helpful, I have been working through some assignments and since I have no teacher to ask I have come to you experts. So the... (6 Replies)
Discussion started by: g2axiom
6 Replies

4. Shell Programming and Scripting

AIX ksh: how to pass variable to host shell

I have a script that "runs" a script. For example: ./runscript.ksh pcnmc01.ksh runscript puts pcnmc01.ksh into the background with log output going to the logfile. After executing the command, I get this output: Running script in the background: pcnmc01.ksh Logfile:... (2 Replies)
Discussion started by: Eben Yong
2 Replies

5. Programming

beginner to c programming

hii friends i m fairy new to c programming.can any one suggest some good websites and some good books for beginner (6 Replies)
Discussion started by: pankajchandel
6 Replies

6. AIX

Beginner's questions about AIX (6.1)

Hello, For some time I have intellistation 9111-285 and I installed AIX 6.1 on it. As a complete beginner I have 2 questions in general about AIX and two specific: 1. is the SMS (system management services) part of AIX? As I noticed when I had Yellowdog Linux installed they weren't available?... (2 Replies)
Discussion started by: kenashkov
2 Replies

7. Shell Programming and Scripting

Beginner in ksh - umask query

I started to learn KSH I am doing some exercises from the book $ umask =rx, u+w $ print Keep track of everythine > file1.out $ print Be careful >> file1.out ksh: file1.out: cannot create $ umask -S ... (1 Reply)
Discussion started by: solaris_user
1 Replies

8. Shell Programming and Scripting

A beginner needing some help programming documents

Hi all, I'm a fairly new beginner with shell programming and python programming. I have a mac (mountain lion OS 10.8.2) and use the terminal for programming. I'm trying to use the unix to easily organize some language data that I am working with. Basically I have to word lists, that I need to... (2 Replies)
Discussion started by: nomadblue
2 Replies

9. Shell Programming and Scripting

Shell Programming (beginner help)

So guys basically I was really sick and couldn't attend the labs and lectures and I went to my lecture hoping he would say ok I will help you from the start but he just said google it. So If it's possible to make the assignment and explain more in detail why is that would be really helpfull. I can... (1 Reply)
Discussion started by: Joola94
1 Replies

10. Shell Programming and Scripting

Unable to replace string in AIX ksh shell

My variable contains the following string I wish to replace \n with "space" so the expected output is: I understand that the /n is not a new linein this case. I'm on AIX using ksh shell. Below is all that I tried. echo $str | sed -e "s#\n# #g"; echo $str | sed -e "s#\n#' '#g";... (5 Replies)
Discussion started by: mohtashims
5 Replies
suspend(1)                                                         User Commands                                                        suspend(1)

NAME
suspend - shell built-in function to halt the current shell SYNOPSIS
sh suspend csh suspend ksh suspend DESCRIPTION
sh Stops the execution of the current shell (but not if it is the login shell). csh Stop the shell in its tracks, much as if it had been sent a stop signal with ^Z. This is most often used to stop shells started by su. ksh Stops the execution of the current shell (but not if it is the login shell). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), kill(1), ksh(1), sh(1), su(1M), attributes(5) SunOS 5.10 15 Apr 1994 suspend(1)
All times are GMT -4. The time now is 11:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy