![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Creating functions in shell script | gjithin | Shell Programming and Scripting | 1 | 05-10-2008 12:15 AM |
| How to call C functions in shell scripts? | agarwal | Shell Programming and Scripting | 5 | 04-08-2008 09:03 PM |
| Calling shell functions from another shell script | jisha | Shell Programming and Scripting | 6 | 04-05-2008 01:29 PM |
| Functions in C-Shell | Raynon | Shell Programming and Scripting | 1 | 07-13-2007 06:17 AM |
| functions in c shell?? | ballazrus | Shell Programming and Scripting | 1 | 02-16-2006 02:14 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Shell script functions
Simple shell script :
date test_fn() { echo "function within test shell script " } on the shell prompt I run > . test Then I invoke the function on the command line as below : test_fn() It echos the line function within test shell script and works as expected. Question (1) how do I find out what are all the shell functions known to the current shell ? I tried set but that does not show my function . I tried which test_fn but that too says it does not know about test_fn (2) how to I make the current shell get rid of the function. I tried unset test_fn - but that does not do it and returns an exit status of 1. Thank you Ram |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
try man bash! (or ksh,csh-tcsh whichever)
it will give you the right variables to find status and such for example if you want to know the return status of the last command type: $ $? to find out what parameter options were set i believe its $- (ex, set -C,) would return a noclobber option and so on.. man bash is usually where you will get answers to questions like these.. set -F etc, etc. hope that helps moxxx68
__________________
moxxx68 http://www.estarinformado.com.ar/apicmaxmiel/bee-diez.gif |
|
#3
|
|||
|
|||
|
moxxx68 - Thanks for your reply, but, that didn't help much.
I want to know what are the exact command and switches in order to display the names of all the functions currently known to the shell. And how to remove the definition of the function from the shell. Thanks, Ram |
|
#4
|
||||
|
||||
|
In ksh, use "typeset +f" and "unset -f".
|
|
#5
|
||||
|
||||
|
can't be that difficult to look it in the man pages can it?
moxxx68 your're welcome!
__________________
moxxx68 http://www.estarinformado.com.ar/apicmaxmiel/bee-diez.gif |
|
#6
|
|||
|
|||
|
Perderabo - Super ! Those worked. Thanks much.
|
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|