# KSH Functions String return

**URL:** <https://community.unix.com/t/ksh-functions-string-return/211597>\
**Category:** Shell Programming and Scripting\
**Created:** [September 8, 2008, 7:05am UTC](https://community.unix.com/t/ksh-functions-string-return/211597 "2008-09-08T07:05:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucae](https://community.unix.com/user_avatar/community.unix.com/lucae/32/1092_2.png) [@lucae](https://community.unix.com/u/lucae)\
**Post date:** [September 8, 2008, 7:05am UTC](https://community.unix.com/t/ksh-functions-string-return/211597/1 "2008-09-08T07:05:03Z")

</div>

Hy everybody

I'm trying to write a function like

function(){  
final=$1  
return $final  
}

but I get following error:  
"return: bad non-numeric arg '[content of $final]'"

what shall I do? Isn't it possible to return strings?😕

thanks  
lucae

---

<div class="post-metadata">

**Author:** ![era](https://community.unix.com/letter_avatar/era/32/5_5575768a8748004e209b776fc1b2916d.png) [@era](https://community.unix.com/u/era)\
**Post date:** [September 8, 2008, 7:12am UTC](https://community.unix.com/t/ksh-functions-string-return/211597/2 "2008-09-08T07:12:09Z")

</div>

Print the string, and call the function with backticks. Return codes (what you can pass back with exit or return) are always numeric, in the range 0 to 255.

```nohighlight
value=`function "fnordness"`

```

---

<div class="post-metadata">

**Author:** ![lucae](https://community.unix.com/user_avatar/community.unix.com/lucae/32/1092_2.png) [@lucae](https://community.unix.com/u/lucae)\
**Post date:** [September 8, 2008, 7:17am UTC](https://community.unix.com/t/ksh-functions-string-return/211597/3 "2008-09-08T07:17:20Z")

</div>

It works, thanks a lot!

lucae from Switzerland
