Can I create a function to return non-interger value in shell script?
for example,
function getcommand ()
{
echo "read command"
read command
echo $command
}
command=$(getcommand)
I tried to do something as above. The statement echo "read command" does not show up.
... (5 Replies)
I want to look into a folder to see if there are any folders within it. If there are, I need to check inside each folder to see if it contains a .pdf file
So
If /myserver/myfolder/
contains a folder AND that folder conatins a .pdf file
do X
Else
do Z
I may have multiple folders and... (4 Replies)
Hi
I have a small function which returns a wrong value.
The function tries to make a connection to oracle database and tries to get the open_mode of the database in the variable status.
However when a database is down the value of the status column is set to READWRITE i am not sure why.
I... (0 Replies)
I need help to store the value returned from the function to one variable and then use that variable.
PREVIOUS_DATE_FUNCTION()
{
date '+%m %d %Y' |
{
read MONTH DAY YEAR
DAY=`expr "$DAY" - 1`
case "$DAY" in
0)
MONTH=`expr "$MONTH" - 1`
case... (1 Reply)
Hi,
I need to return a value from the function. the value will be the output from cat command which uses random fucntion.
#!/bin/ksh
hello()
{
var1=$(`cat /dev/urandom| tr -dc 'a-zA-Z0-9-!%&()*+,-/:;<=>?_'|fold -w 10 | head -n 1`)
echo "value is" var1
return var1
}
hello
var=$?... (2 Replies)
I'm having a little trouble returning a value from a function or calling it, I'm not quite sure.
I'm calling the function here
function region_lookup_with_details {
results = $(set_region)
echo $results
}
This is the function I'm calling
function set_region {
... (8 Replies)
I have two DNS resolvers in /etc/resolv.conf file. The top one is Windows DNS server, and the bottom one is my wi-fi router. Please see below. nameserver 192.168.1.126 nameserver 192.168.1.1
In Windows DNS server, the sole "Forward Lookup Zone" is biman.net
When I query for host in the zone... (6 Replies)
Discussion started by: broy32000
6 Replies
LEARN ABOUT PLAN9
dlsym
DLSYM(3) Linux Programmer's Manual DLSYM(3)NAME
dlsym, dlvsym - obtain address of a symbol in a shared object or executable
SYNOPSIS
#include <dlfcn.h>
void *dlsym(void *handle, const char *symbol);
#define _GNU_SOURCE
#include <dlfcn.h>
void *dlvsym(void *handle, char *symbol, char *version);
Link with -ldl.
DESCRIPTION
The function dlsym() takes a "handle" of a dynamic loaded shared object returned by dlopen(3) along with a null-terminated symbol name, and
returns the address where that symbol is loaded into memory. If the symbol is not found, in the specified object or any of the shared
objects that were automatically loaded by dlopen(3) when that object was loaded, dlsym() returns NULL. (The search performed by dlsym() is
breadth first through the dependency tree of these shared objects.)
Since the value of the symbol could actually be NULL (so that a NULL return from dlsym() need not indicate an error), the correct way to
test for an error is to call dlerror(3) to clear any old error conditions, then call dlsym(), and then call dlerror(3) again, saving its
return value into a variable, and check whether this saved value is not NULL.
There are two special pseudo-handles that may be specified in handle:
RTLD_DEFAULT
Find the first occurrence of the desired symbol using the default shared object search order. The search will include global sym-
bols in the executable and its dependencies, as well as symbols in shared objects that were dynamically loaded with the RTLD_GLOBAL
flag.
RTLD_NEXT
Find the next occurrence of the desired symbol in the search order after the current object. This allows one to provide a wrapper
around a function in another shared object, so that, for example, the definition of a function in a preloaded shared object (see
LD_PRELOAD in ld.so(8)) can find and invoke the "real" function provided in another shared object (or for that matter, the "next"
definition of the function in cases where there are multiple layers of preloading).
The _GNU_SOURCE feature test macro must be defined in order to obtain the definitions of RTLD_DEFAULT and RTLD_NEXT from <dlfcn.h>.
The function dlvsym() does the same as dlsym() but takes a version string as an additional argument.
RETURN VALUE
On success, these functions return the address associated with symbol. On failure, they return NULL; the cause of the error can be diag-
nosed using dlerror(3).
VERSIONS
dlsym() is present in glibc 2.0 and later. dlvsym() first appeared in glibc 2.1.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
+------------------+---------------+---------+
|Interface | Attribute | Value |
+------------------+---------------+---------+
|dlsym(), dlvsym() | Thread safety | MT-Safe |
+------------------+---------------+---------+
CONFORMING TO
POSIX.1-2001 describes dlsym(). The dlvsym() function is a GNU extension.
NOTES
History
The dlsym() function is part of the dlopen API, derived from SunOS. That system does not have dlvsym().
EXAMPLE
See dlopen(3).
SEE ALSO dl_iterate_phdr(3), dladdr(3), dlerror(3), dlinfo(3), dlopen(3), ld.so(8)COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
Linux 2017-09-15 DLSYM(3)