In the above the value of target is not being propagated to the function while ideally it should be since typeset variables are visible in sub functions
What is the issue here
The issue is that "$target" is assigned some unspecified value "$server_type", which may contain either an empty value or might be undefined or maybe contains characters with a special meaning to the shell so that they become interpreted because the variable "$server_type" is used without proper quoting.
In addition, you seem to have no firm grasp of the variable scope in shell languages. The "typeset" keyword just declares a variable. You need to "export" them to make them available in subshells.
To top it off the concept of using a variable from the calling function is flawed in itself: if you want to pass some value to a subfunction use some explicit mechanism, like passing a parameter:
Code:
function sub1
{
target="$1"
print - "target in sub1() is: $target"
return 0
}
function caller
{
target="some-value"
print - "target in caller() is: $target"
sub1 "$target"
return 0
}
Finally, you have neither supplied complete code (because the snippet you presented seems to be only a small incomplete part) and you haven't shown any output the complete script has produced. How are we supposed to find out what went wrong with such incomplete data? We're admins, not psychics.
Hi all,
I have problem understanding shell script.Written that
$bindir/put_load.ksh ; typeset RV= $?
I dont have any other document about script. How can i find that $bindir is exist or not what is the content of that, i am working on new box . how can i search that in old box what... (4 Replies)
I have found this command *typeset* and the option * -f *, which should provide me the list of all the currently defined functions. Is there any possibility of specifying the file in which this command to search ? (1 Reply)
Hi,
Could any one please explain about typeset or share any link from where i can study about typeset i.e how to use it, how to define it.. etc?
Thanks-
Yogi (3 Replies)
Hi,
Can any one please explain me the use of 'typeset' in shell scripting?
I donot under stand the use and advantages of using typeset.
In one of our script, it is written like typeset VERBOSE NO_UPDATE
typeset LOAD_SYBASE_TABLES
I donot understand what actually these lines do.
As per my... (2 Replies)
Hi,
All the scripts we have here use typeset instead of normal variables.
They don't have any parameters, they just get declared at the beginning of the scripts like this: typeset var1 var2 var3Could anyone tell me why this is done? I don't see the advantage in this over using normal variables. (1 Reply)
Hi,
As per my understanding typeset wil lmake a variable constant or readonly and -i option will make a variable integer. But please see the below outputs
typeset -i abc=000001;echo $abc
1
typeset -i abc=0000010;echo $abc
8
typeset -i abc=00000100;echo $abc
64
typeset -i... (3 Replies)
Hi All,
typeset -Z4 curtime command is giving different result than expected inside scripts in linux.But it gives expected results outside the scripts.Can you please help us
---------- Post updated at 05:37 AM ---------- Previous update was at 05:25 AM ----------
curTime=`date +%H%M`... (5 Replies)
I don't have man typeset entry in unix.
what is the use of typeset command and can you give some examples for that. (1 Reply)
Discussion started by: ramkumar15
1 Replies
LEARN ABOUT SUSE
utrace_prepare_examine
UTRACE_PREPARE_EXAMI(9) utrace core API UTRACE_PREPARE_EXAMI(9)NAME
utrace_prepare_examine - prepare to examine thread state
SYNOPSIS
int utrace_prepare_examine(struct task_struct * target, struct utrace_engine * engine, struct utrace_examiner * exam);
ARGUMENTS
target
thread of interest, a struct task_struct pointer
engine
engine pointer returned by utrace_attach_task
exam
temporary state, a struct utrace_examiner pointer
DESCRIPTION
This call prepares to safely examine the thread target using struct user_regset calls, or direct access to thread-synchronous fields.
When target is current, this call is superfluous. When target is another thread, it must held stopped via UTRACE_STOP by engine.
This call may block the caller until target stays stopped, so it must be called only after the caller is sure target is about to
unschedule. This means a zero return from a utrace_control call on engine giving UTRACE_STOP, or a report_quiesce or report_signal callback
to engine that used UTRACE_STOP in its return value.
Returns -ESRCH if target is dead or -EINVAL if UTRACE_STOP was not used. If target has started running again despite UTRACE_STOP (for
SIGKILL or a spurious wakeup), this call returns -EAGAIN.
When this call returns zero, it's safe to use struct user_regset calls and task_user_regset_view on target and to examine some of its
fields directly. When the examination is complete, a utrace_finish_examine call must follow to check whether it was completed safely.
Kernel Hackers Manual 2.6. July 2010 UTRACE_PREPARE_EXAMI(9)