Custom libraries possible on AIX 4.2 ?


 
Thread Tools Search this Thread
Operating Systems AIX Custom libraries possible on AIX 4.2 ?
# 1  
Old 03-10-2010
Data Custom libraries possible on AIX 4.2 ?

I had started writting my own custom libraries on an AIX 4.2. Before finishing, I wanted to do a very simple test. So I wrote the followings:

test.sh
#!/bin/ksh
. testlib.sh
ZZ=testz "aa" "bb"
echo "$ZZ"
exit 0
testlib.sh
testz () {
return "$1$2"
}
When I ran my test.sh, I got an error message saying :
test.sh[3]: aa: not found.

According to my book where I read about creating custom libraries, this should work. Are custom libraries allowed on AIX 4.2 or did I understood wrong about how to do it ?
# 2  
Old 03-10-2010
the mistake in your script:

Code:
ZZ=testz "aa" "bb"

should be

Code:
ZZ='testz "aa" "bb"'

otherwise you set ZZ to "test" and run an executable aa with option bb


or you want to set the variable ZZ to the output of testz "aa" "bb", then you need the following syntax:

Code:
ZZ=$(testz "aa" "bb")

# 3  
Old 03-10-2010
I used ZZ=$(test "aa" "bb") because I want to set ZZ to the result of that function using those 2 options/parms.

However, when I echo the content of $ZZ, it is empty.

In my testz library function, I added an echo on both $1 and $2 to see if the "aa" and "bb" were passed on. They are.

test.sh
#!/bin/ksh
. testlib.sh
ZZ=$(testz "aa" "bb")
echo "$ZZ"
exit 0
testlib.sh
testz () {
echo $1
echo $2
return "$1$2"
}
Also, lets say I want to return more then one value back (ex: 10 03 2010) without putting them into quotes, is it possible ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Custom AIX Prompt

In my .profile, my prompt is set like this: set -o vi PS1=`logname`@`hostname -s`:'$PWD>' Is there a way to show what the history number would be of the command I'm typing in the prompt? For example, I frequently run commands then run 'history' to pull up the history number of a command... (2 Replies)
Discussion started by: ptrotter
2 Replies

2. AIX

Problem with AIX: shared libraries aren't loaded

Hello guys, I have a trouble when running an application in AIX, I've compiled and the LIBRARY_PATH seems ok, but I get the following message: rtld: 0712-001 Symbol __pthread was referenced from module main_app(), but a runtime definition of the symbol was not found ldd... (4 Replies)
Discussion started by: edgarvm
4 Replies

3. Programming

I want to know some c libraries

I'm a rookie to C and i'm looking for some libraries to learn,something likes the C++ STL or Boost ,does any1 can tell me some of them?Thanks a lot:) Eric (3 Replies)
Discussion started by: homeboy
3 Replies

4. AIX

AIX custom package install query

I have created a .bff package for an app to tbe installed on AIX servers across regions. I am pretty new to the AIX mode of packaging using mkinstallp but I have been able to get the same done. I installed the same on the server in which i created the package and the application was deployed... (9 Replies)
Discussion started by: jobbyjoseph
9 Replies

5. Shell Programming and Scripting

How to use two different libraries?

Hello, I need to use two different libraries like /usr/local/bin/expect and /usr/bin/ksh at the same script. Is it possible? (4 Replies)
Discussion started by: fozay
4 Replies

6. UNIX for Dummies Questions & Answers

libraries

I am slowly ploughing my way through the list of links to on-line tutorials you provided to newbies. I for one am grateful for such a comprehensive list, so first of all thank you for that. What i cannot seem to find, is information on C++ libraries: The two links on libraries in your list... (0 Replies)
Discussion started by: pil888
0 Replies

7. AIX

memory problem in AIX shared libraries

Hi All, I'm facing the following issue with my shared libraries in AIX. memory related calls such as memset, memcpy, malloc etc are failing miserably. there is something wrong with stack/memory which i can't guess. i've used the following flags to build my libraray: ld -G... (0 Replies)
Discussion started by: abhinav05252
0 Replies

8. IP Networking

Libraries

How is Libnet and libpcap are useful in sending a packet through DLL layer and sniff network layer? and how sinffers are used to track ip adresses provided Mac adresses? (1 Reply)
Discussion started by: netsavy
1 Replies

9. Programming

C Libraries??

I can not locate package sys/mkdev.h on HP-UX or Linux. Is it a special package or something? (9 Replies)
Discussion started by: laila63
9 Replies

10. Programming

shared libraries

I am compiling code which produces .a and .la libraries. How can I produce .so libraries? I know that gcc -shared does but how? (2 Replies)
Discussion started by: thalex
2 Replies
Login or Register to Ask a Question