Sponsored Content
Top Forums Shell Programming and Scripting Function invocation $(func "hi") does not work Post 302811061 by balajesuri on Thursday 23rd of May 2013 03:06:00 AM
Old 05-23-2013
Quote:
Originally Posted by shreedhar.rk123
yes, the execution is fine with no errors but at the same time no output(which is not wat is expected).

i am expecting the
echo "PRAMATER RECEIVED IS $1"
to get executed and is seen on STDOUT.

in any of the cases

VALUE=`func "hi"`
or
VALUE=$(func "hi")
Based on what do you think this is not the expected output?

Adding to Don Cragun's explanation, from your example, when you run a command in backticks, the output of that command is stored in a variable.

When you say cont=`cat file.txt`, the contents of file.txt are stored in variable "cont".

Similarly, when you invoke the function "func", the output of func is stored in variable "VALUE". This is the expected behaviour.

Last edited by balajesuri; 05-23-2013 at 04:07 AM.. Reason: Late post by a minute. OP's query already clarified by Don Cragun.
 

7 More Discussions You Might Find Interesting

1. Programming

How to convert the "select" function into a "poll" function

i have a program using the select function but i want to convert it to poll... how can i do this? thanks in advance... :) (1 Reply)
Discussion started by: rbolante
1 Replies

2. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

3. HP-UX

ERROR: more than one instance of overloaded function "vprintf" has "C" linkage

Hi people! I've got this own library: -------------------------------------------- Personal.h -------------------------------------------- #ifdef __cplusplus extern "C" { #endif #include <stdio.h> #include <stdarg.h> #include <string.h> ... (0 Replies)
Discussion started by: donatoll
0 Replies

4. OS X (Apple)

Neither "which" nor "find" commands work

hi there, could use some basic PATH advice, i think, or something find sometimes work, but which hasn't ever seemed to. for years! what am i doing wrong that the commands which and find rarely work? they used to work on the workstations i used ages ago... running 10.5.8 because i... (4 Replies)
Discussion started by: zensnob
4 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

7. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
door_return(3DOOR)					      Door Library Functions						door_return(3DOOR)

NAME
door_return - return from a door invocation SYNOPSIS
cc -mt [ flag ... ] file ... -ldoor [ library ... ] #include <door.h> int door_return(char *data_ptr, size_t data_size, door_desc_t *desc_ptr, uint_t num_desc); DESCRIPTION
The door_return() function returns from a door invocation. It returns control to the thread that issued the associated door_call() and blocks waiting for the next door invocation. See door_call(3DOOR). Results, if any, from the door invocation are passed back to the client in the buffers pointed to by data_ptr and desc_ptr. If there is not a client associated with the door_return(), the calling thread discards the results, releases any passed descriptors with the DOOR_RELEASE attribute, and blocks waiting for the next door invocation. RETURN VALUES
Upon successful completion, door_return() does not return to the calling process. Otherwise, door_return() returns -1 to the calling process and sets errno to indicate the error. ERRORS
The door_return() function fails and returns to the calling process if: E2BIG Arguments were too big for client. EFAULT The address of data_ptr or desc_ptr is invalid. EINVAL Invalid door_return() arguments were passed or a thread is bound to a door that no longer exists. EMFILE The client has too many open descriptors. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Architecture |all | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
door_call(3DOOR),libdoor(3LIB), attributes(5) SunOS 5.10 5 Feb 2001 door_return(3DOOR)
All times are GMT -4. The time now is 06:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy