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)
Is there a command where I can pipe my grep into it and it will output it with spaces rather than returns?
Example
I want to turn
prompt$ grep blah file
blah
blah
into this
prompt$ grep blah file | someCommand
blah blah (1 Reply)
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)
Hi all,
I am trying to grep a .txt file for a word. When I hit enter, it returns back to $
The file is 4155402 in size and is named in this way:
*_eveningtimes_done_log.txt
I use this command, being in the same directory as the file:
grep -i "invalid" *_eveningtimes_done_log.txt
... (16 Replies)
Sometimes I observe this in gdb:
(gdb) br my_function
Breakpoint .. at 0x...: file ..., line ...
i.e., "my_function" does exist in the current executable.
however, dlsym does not find it:
(gdb) p dlsym(0,"my_function")
$6 = 0
This is a C program; dlsym does find other defined functions and... (2 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)
This returns 0 even when it does not delete any files.
Is it because -print returns 0?
RETVAL=$?
Docs_Backups=/media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/Documents_Backups/
Scripts_Backups=/media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/Script_Backups/
# create some old files
#touch -d 20120101... (4 Replies)
Discussion started by: drew77
4 Replies
LEARN ABOUT PHP
timezone_name_from_abbr
TIMEZONE_NAME_FROM_ABBR(3) 1 TIMEZONE_NAME_FROM_ABBR(3)timezone_name_from_abbr - Returns the timezone name from abbreviationSYNOPSIS
string timezone_name_from_abbr (string $abbr, [int $gmtOffset = -1], [int $isdst = -1])
DESCRIPTION PARAMETERS
o $abbr
- Time zone abbreviation.
o $gmtOffset
- Offset from GMT in seconds. Defaults to -1 which means that first found time zone corresponding to $abbr is returned. Otherwise
exact offset is searched and only if not found then the first time zone with any offset is returned.
o $isdst
- Daylight saving time indicator. Defaults to -1, which means that whether the time zone has daylight saving or not is not taken
into consideration when searching. If this is set to 1, then the $gmtOffset is assumed to be an offset with daylight saving in
effect; if 0, then $gmtOffset is assumed to be an offset without daylight saving in effect. If $abbr doesn't exist then the time
zone is searched solely by the $gmtOffset and $isdst.
RETURN VALUES
Returns time zone name on success or FALSE on failure.
EXAMPLES
Example #1
A timezone_name_from_abbr(3) example
<?php
echo timezone_name_from_abbr("CET") . "
";
echo timezone_name_from_abbr("", 3600, 0) . "
";
?>
The above example will output something similar to:
Europe/Berlin
Europe/Paris
SEE ALSO timezone_abbreviations_list(3).
PHP Documentation Group TIMEZONE_NAME_FROM_ABBR(3)