LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-23-2005, 04:55 AM   #1
Asadullah Rathore
LQ Newbie
 
Registered: Sep 2005
Posts: 4

Rep: Reputation: 0
Typeset issues


Hello,

The problem is as follows :

IN UNIX MPRAS :-

file :- check

Contents :-

#!/usr/bin/ksh

function pic
{

echo "Hello"

}

typeset -fx pic

./$1

file :- sample

Contents:-

pic

on prompt :- ./check sample
output :- Hello

Same code and files are present in kshell in Red Hat Enterprise Version 3.

output is :- .lf 1 -

Why is there a difference? How can the same output in Red Hat be produced using a similar procedure ?

Thank you.
 
Old 09-24-2005, 12:07 PM   #2
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 25, 26, RHL 5.2
Posts: 560

Rep: Reputation: 56
The problem here is that the check script is not executing your pic function at the ./$1 statement. It is starting another process and running pic which is a program to compile pictures for troff or TeX. However, if you execute sample in the same process it will work as you expect. Using . ./sample executes the contents of sample in the same process. Using ./sample starts another process to execute sample and the pic function is not available to that process. Here is the code I used to produce the desired result.

check script
Code:
#!/usr/bin/ksh
 
function pic
{
echo "Hello"
}
 
. ./$1
sample script
Code:
pic
Note that I removed the typeset command. AFAIK functions cannot be exported like variables in ksh. They can be made available in memory using .profile or $FPATH along with the autoload feature of ksh. The only typeset options I have used with functions are -f -f fname +f -ft +ft and -fu. Function names do take precedence over executables or scripts so take care in what you name them.

Bill
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
typeset issues in ksh talalrabbani Linux - Distributions 0 09-23-2005 12:13 AM
X11 TTF Issues; OOo Font Issues Kenji Miyamoto Slackware 2 05-27-2005 06:30 PM
New to linux, so so lost, auto mounting issues, permissions issues slowhand22 Linux - Newbie 2 02-10-2005 09:41 AM
typeset not working XST1 Programming 3 02-06-2005 11:29 PM
Sound issues + Mouse wheel issues matt3333 Slackware 2 10-12-2003 03:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration