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 MOJAVE
dlsym
DLSYM(3) BSD Library Functions Manual DLSYM(3)NAME
dlsym -- get address of a symbol
SYNOPSIS
#include <dlfcn.h>
void*
dlsym(void* handle, const char* symbol);
DESCRIPTION
dlsym() returns the address of the code or data location specified by the null-terminated character string symbol. Which libraries and bun-
dles are searched depends on the handle parameter.
If dlsym() is called with a handle, returned by dlopen() then only that image and any libraries it depends on are searched for symbol.
If dlsym() is called with the special handle RTLD_DEFAULT, then all mach-o images in the process (except those loaded with dlopen(xxx,
RTLD_LOCAL)) are searched in the order they were loaded. This can be a costly search and should be avoided.
If dlsym() is called with the special handle RTLD_NEXT, then dyld searches for the symbol in the dylibs the calling image linked against when
built. It is usually used when you intentionally have multiply defined symbol across images and want to find the "next" definition. It
searches other images for the definition that the caller would be using if it did not have a definition. The exact search algorithm depends
on whether the caller's image was linked -flat_namespace or -twolevel_namespace. For flat linked images, the search starts in the load
ordered list of all images, in the image right after the caller's image. For two-level images, the search simulates how the static linker
would have searched for the symbol when linking the caller's image.
If dlsym() is called with the special handle RTLD_SELF, then the search for the symbol starts with the image that called dlsym(). If it is
not found, the search continues as if RTLD_NEXT was used.
If dlsym() is called with the special handle RTLD_MAIN_ONLY, then it only searches for symbol in the main executable.
RETURN VALUES
The dlsym() function returns a null pointer if the symbol cannot be found, and sets an error condition which may be queried with dlerror().
NOTES
The symbol name passed to dlsym() is the name used in C source code. For example to find the address of function foo(), you would pass "foo"
as the symbol name. This is unlike the older dyld APIs which required a leading underscore. If you looking up a C++ symbol, you need to use
the mangled C++ symbol name.
SEE ALSO dlopen(3)dlerror(3)dyld(3)ld(1)cc(1)
August 28, 2008