Function Problem and CoreDump

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Function Problem and CoreDump
# 1  
Old 02-19-2008
Function Problem and CoreDump

Hi, i have a question:

i build this function:

function WriteLog {

print $*
print $* >> FileLog


the function are called with this sintax:




this operation work correctly.

but when call the function with this sintax:

WriteLog $A$B


WriteLog "\tXXXXXX \tXXXXXX \c"


WriteLog $A${B[XX]}


I have error "COREDUMP"

but if assign a variable the string : for ex StringaExe="X\tBBBBBB\t\tCCCC"

and call WriteLog $StringExe

I have not problem !!!!

I Things $* it's correctly assign when call the function ????
# 2  
Old 02-19-2008
function WriteLog {
print "$1"
print "$1" >> FileLog

# call it with " around the arguments, example:
WriteLog "$A${B[XX]}"

# 3  
Old 02-19-2008
not work ..

I have the same error

the call WriteLog ""\tCAMPA\t\t CAMPB\tCAMPC""

or WriteLog "\tCAMPA\t\t CAMPB\tCAMPC"
return e error

if write BBB="\tCAMPA\t\t CAMPB\tCAMPC"

and call WriteLog $BBB

work correctly
# 4  
Old 02-19-2008

What shell are you using, what unix system? Most shells do not dump core in my experience.
# 5  
Old 02-19-2008
ksh93 in Hp/ux system
# 6  
Old 02-19-2008
Got it - ksh93 is an "add-on" not part of the HPUX standard distribution, AFAIK. For our HPUX boxes we get support only on sh and ksh. YMMV.

I believe you have a shell problem. The examples I gave you and the examples you gave me that failed are POSIX compliant and should work in a POSIX shell. I don't know how you'd get support from HP -- which is where I would start in another circumstance.

If you cannot get support, try /usr/bin/ksh Your examples should never coredump.
# 7  
Old 02-19-2008
i have insert in the fuction the declare :

#!/usr/bin/sh or /usr/bin/ksh

function WriteLog {




the shell work correctly and i use in the rest ksh93 !!!!

I don't Know because the sintax ksh93 in the function don't work !!!!

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with (Understanding) function

I have this code #!/bin/bash LZ () { RETVAL="\n$(date +%Y-%m-%d_%H-%M-%S) --- " return RETVAL } echo -e $LZ"Test" sleep 3 echo -e $LZ"Test" which I want to use to make logentrys on my NAS. I expect of this code that there would be output like 2017-03-07_11-00-00 --- Test (4 Replies)
Discussion started by: matrois
4 Replies

2. Shell Programming and Scripting

Coredump when passing file name to ksh function

Hi, I'm playing with ksh. I'm trying to do a simple task: read file name from cli and call a function which calculated number of lines in file. I'm getting coredump every time when I try to read that file. Korn shell version $ print ${.sh.version} Version AJM 93u+ 2012-08-01 Main... (5 Replies)
Discussion started by: solaris_user
5 Replies

3. Shell Programming and Scripting

Function problem

hey guys, im trying to learn bourne shell atm and I'm having some issues with functions. so heres my code: #!/bin/bash ##functions memory () { free -m } space () { df -h } ip () { (5 Replies)
Discussion started by: hawkfro12
5 Replies

4. Shell Programming and Scripting

Calling Function Problem

Hi, I had a scripts which calls two function. One function will call another function, script is working fine but the second function is not calling the first function. Below is the script #!/usr/bin/ksh fun1() { echo $DATETIME >> Test1.ksh return 0 } fun2() { typeset DATETIME=`date... (5 Replies)
Discussion started by: somu_june
5 Replies

5. Shell Programming and Scripting

splice function problem

Hi All, I am using splice function in for loop to delete particular element from array with one condition. my $cnt=0; foreach my $elem (@result) { if (condition){ splice(@result, $cnt, 1);} else{ $cnt++;} } Now when in array, two elements comes sequentially with the... (3 Replies)
Discussion started by: gentleDean
3 Replies

6. Shell Programming and Scripting

problem, with if condition in function

Hi All, I have a function which reads parameter and gets the value from config file. The entry in the file can be either of two Name=value or Name=value so if the variant is not present it should return me the generic value ie Name without variant. I am first searching for variant in... (4 Replies)
Discussion started by: gurukottur
4 Replies

7. Shell Programming and Scripting

Problem with function script.

Need an extra set of eyes. Can't find function. Can someone help, please. Thanks echo " Is this the correct list of tapes to eject (y/n)?" read option echo $option case $option in y|Y) TAPE_ROUTINE;; ... (3 Replies)
Discussion started by: gzs553
3 Replies

8. Shell Programming and Scripting

Problem with Recursive function

Hi all, I have to move all the files in a tree directory structure to a single directory. Inorder to know which file is from which directory , i'll have to add the name of the directory to the file name. For this i wrote a recursive function which is as follows... (4 Replies)
Discussion started by: malle
4 Replies

9. Shell Programming and Scripting

PERL function problem

I have perl script as follow. ------------------------------------------------------------------------ #! /usr/bin/env perl use strict; sub printLines { print "Inside the function.............\n"; my (@file , $count , $key ) = $_; print $count , $ key ; #... (2 Replies)
Discussion started by: avadhani
2 Replies

10. Programming

rexec() function problem

Hi folks, I'm trying to make a reconnection algorithm using rexec(), but I noticed that when rexec() fails returning -1, it is impossible to make it run successfully again until you restart the program or the thread. Example, I have a endless loop for connection retries, if I supply a wrong... (7 Replies)
Discussion started by: lcmoreno
7 Replies
Login or Register to Ask a Question