The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need help in checking the date and looking for a keyword in a script tatchel Shell Programming and Scripting 0 04-21-2008 09:46 PM
how to search a keyword within a file using a for loop lucho_1 Shell Programming and Scripting 6 03-10-2008 02:57 PM
keyword searching of documents Miles OS X (Apple) 1 02-25-2008 06:38 PM
Far Keyword svh High Level Programming 2 02-08-2006 12:16 AM
Keyword in perl sarwan Shell Programming and Scripting 1 01-17-2006 04:35 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-25-2008
novice1324 novice1324 is offline
Registered User
  
 

Join Date: Feb 2008
Location: SFO, Ca, US
Posts: 10
Using $0 and 'Function' Keyword

Hi all,

I had a query on the usage of $0 in shells. I would appreciate any assistance in this.

We moved from a sun solaris server to a linux server. I ran 2 different pieces on these servers and in one case, the outputs didnt change and in the other case, the outputs were different. The 2 pieces involved defining functions differently.

Case #1
----------------------------------
#!/bin/ksh

echo "Value of $0 outside"

function callme2
{
echo "Value of $0 inside"
}

callme2
----------------------------------

Case #2
----------------------------------
#!/bin/ksh

echo "Value of $0 outside"

callme2()
{
echo "Value of $0 inside"
}

callme2
----------------------------------

Sun solaris output was the same in both cases, as given below.

Value of test.ksh outside
Value of test.ksh inside

But, the linux server gave different outputs.

case #1 output

Value of .//test.ksh outside
Value of callme2 inside

case #2 output

Value of .//test.ksh outside
Value of .//test.ksh inside

Can someone assist me in understanding why these differences exist inspite of the shell remaining the same and also what can be done to prevent this from occurring.

Thank you very much for your time...!!
 

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 07:12 AM.


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