The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem with function script. gzs553 Shell Programming and Scripting 3 04-21-2008 03:15 PM
Problem with Recursive function malle Shell Programming and Scripting 4 02-03-2007 10:40 AM
PERL function problem avadhani Shell Programming and Scripting 2 06-15-2005 04:18 AM
Problem with aio_write() function hmurali High Level Programming 0 06-04-2002 12:43 AM
rexec() function problem lcmoreno High Level Programming 7 01-08-2002 10:19 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-19-2008
ZINGARO ZINGARO is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 36
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:

.....
.....

WriteLog "XXXXXXXX"

......

this operation work correctly.

but when call the function with this sintax:

WriteLog $A$B

or

WriteLog "\tXXXXXX \tXXXXXX \c"

or

WriteLog $A${B[XX]}

or
WriteLog "XXXXXX"" ""BBBBBBB"

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 (permalink)  
Old 02-19-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
try:
Code:
function WriteLog {
print "$1"
print "$1" >> FileLog
}

# call it with " around the arguments, example:
WriteLog "$A${B[XX]}"
  #3 (permalink)  
Old 02-19-2008
ZINGARO ZINGARO is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 36
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 (permalink)  
Old 02-19-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
okay.

What shell are you using, what unix system? Most shells do not dump core in my experience.
  #5 (permalink)  
Old 02-19-2008
ZINGARO ZINGARO is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 36
ksh93 in Hp/ux system
  #6 (permalink)  
Old 02-19-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:30 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0