How to make nested function local?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to make nested function local?
# 8  
Old 06-22-2017
Hi.

The more complete version string for the Linux ksh that I used is Version AJM 93u+ 2012-08-01

Also found on:
Code:
CentOS 6.4
Fedora 23
Ubuntu 14.04.4
Slackware 14.1
FreeBSD 11.0
macOS 10.12.5

Perhaps a more recent version of ksh for Solaris is available from a source other than Oracle.

Best wishes ... cheers, drl

Last edited by drl; 06-22-2017 at 04:35 PM..
# 9  
Old 06-23-2017
Quote:
Originally Posted by chebarbudo
Thanks MadeInGermany,

I didn't think about your approach. And I didn't know there was no such local functions.
Why do you want to have a local function? From my personal experience, the main use is for passing around (anonymous) function objects or closures, which can't be done in bash anyway. Where is the problem to just name it differently?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Function - Make your function return an exit status

Hi All, Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition. #Body function1() { if then echo "exist" else echo "not exist" } #if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies

2. Programming

Local variable in a C function is not getting created in stack when its compiled with GCC

Hi, I am working in UEFI EDK2 Bios source. We created a platform related new package in the EDK2 source. I find a strange issue with the platform related code we added. When I did source level debugging I noticed the local variable in a C function is not getting created in stack when its... (6 Replies)
Discussion started by: Divya R
6 Replies

3. Shell Programming and Scripting

/usr/local/bin/expr function not working

Legends, I am not able to set "expr" function in ksh script. Below is the sample code i used, and output is as "Syntax error" Please help me to come out of it. OUTPUT (9 Replies)
Discussion started by: sdosanjh
9 Replies

4. Programming

Returning local string value from a function in C

Hi, If I have a code like this, what are the potential problems do you see? const char* const retString() { return "hello"; /* string literal */ } My questions are: a) Since the string literal which is already a constant read only data (cannot be... (4 Replies)
Discussion started by: royalibrahim
4 Replies

5. Programming

Thread function local variables

As I know threads share the memory. But, what about the local variables in the thread function? if i call multiple threads would they allocate seperate local variables for themselves? like thread_func() { int i, j; string... } Are the above local variables defined for each of... (1 Reply)
Discussion started by: saman_glorious
1 Replies

6. UNIX for Dummies Questions & Answers

make - foreach function

I wrote the following Makefile: dirs := a b c d files := $(foreach dir,$(dirs),$(wildcard $(dir)/*)) .PHONY: all all: touch $(files) The first two lines are taken from GNU make tutorial, Section 8.5 The foreach Function. I would expect the recipe touch $(files) to be... (2 Replies)
Discussion started by: ybelenky
2 Replies

7. Shell Programming and Scripting

remotely call function from local script

The following code doesn't work properly which means it doesn't displays remote output. #!/bin/ksh #################### Function macAddressFinder ######################## macAddressFinder() { `ifconfig -a > ipInterfaces` `cat ipInterfaces` }... (2 Replies)
Discussion started by: presul
2 Replies

8. UNIX for Dummies Questions & Answers

How to call a local function within Awk

Hi, I have the following statement which parses a string for me and prints it out: l_comp="dc000.runksh.test.ksh| $g_sql/dc0000.runksh_test.sql|new.dat|control.ctl" echo $l_comp | awk -F"|" '{ for ( i = 1; i <= NF; i++) { print $i; } } ' Rather then printing the data, I would like to... (5 Replies)
Discussion started by: CAGIRL
5 Replies

9. Shell Programming and Scripting

How to execute local function in awk

Hi All, Can you please tell me how to execute local function written in a shell script with awk. i tried with system command but its giving an error. (1 Reply)
Discussion started by: krishna_gnv
1 Replies

10. Shell Programming and Scripting

How to make variables in script function local?

Is it possible to make function variables local? I mean for example, I have a script variable 'name' and in function I have declared variable 'name' I need to have script's 'name' have the same value as it was before calling the function with the same declaration. The way to preserve a... (5 Replies)
Discussion started by: alex_5161
5 Replies
Login or Register to Ask a Question