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 ?

the mistake in your script:

ZZ=testz "aa" "bb"

should be

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:


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

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 ?