Clearing a defined function from memory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Clearing a defined function from memory
# 1  
Old 05-12-2009
MySQL Clearing a defined function from memory

I guess what I mean is: is there something like unalias to clear functions defined by sourcing a script or config/alias file from memory?

Is it necessary to start a new terminal session, or can it be done with a command? I tried "function somefunc {}" but bash told me it hit an "unexpected token" @ the close-bracket.

BZT

EDIT: Googled and found it -- here. Short answer: use unset -v [funcname] (without brackets of course), then test by typing in the name of the function at the next prompt.

Gee, if I had just taken a minute to Google, there'd be about 775,000 bytes more on this forum's server disks.

Last edited by otheus; 05-16-2009 at 07:52 AM.. Reason: Found the solution
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Call user defined function from awk

My requirement is to call function ("fun1") from awk, and print its returned value along with $0. fun1() { t=$1 printf "%02d\n", $t % 60; } echo "Hi There 23" | awk '{print $0; system(fun1 $3)}' Any suggestions what to be modified in above code to achieve requirement.. (5 Replies)
Discussion started by: JSKOBS
5 Replies

2. UNIX for Dummies Questions & Answers

Clearing memory cache on Linux server

i wish to clear memory cache on a production box and i was wondering what is the worst that can happen if i do? i already tested this on a backup server and everything seemed fine. but i need to know from you experts what are the worst things that can happen when i run it on a real server: ... (5 Replies)
Discussion started by: SkySmart
5 Replies

3. UNIX for Dummies Questions & Answers

Problem syntax with user-defined function

Hi ! I got a script from Arabic to Roman numeral conversion - .comp.lang.awk, that I would like to modify to apply it on my input file. input ("|"-delimited fields): AAAAAA|1, 10, 13, 14, 25, 60 wanted output: AAAAAA|I, X, XIII, XIV, XXV, LX script.awk: #!/usr/bin/gawk -f ... (11 Replies)
Discussion started by: lucasvs
11 Replies

4. Shell Programming and Scripting

How to pass parameter to User defined function in shell script?

Hello, Can anyone guide me tin passing parameters into user defined function of shell script (KSH). Here is my code, InsertRecord() { DB_TBL=$(sqlplus $USERID/$PASSWORD@$DATABASE << EOF set head off set feed off set serveroutput on INSERT INTO TBL1 ( OLD_VAL, NEW_VAL, ... (7 Replies)
Discussion started by: Poonamol
7 Replies

5. UNIX and Linux Applications

strange behavior of PSQL user defined function

Segregated the problematic portion, and showing for your view here., 1. Following is the function definition, create or replace function new_del(id integer) returns void as $$ begin raise info 'dollar :%',$1; delete from testing where id=$1; end ; $$ language 'plpgsql'; ... (1 Reply)
Discussion started by: thegeek
1 Replies

6. Shell Programming and Scripting

Return an array of strings from user defined function in awk

Hello Friends, Is it possible to return an array from a user defined function in awk ? example: gawk ' BEGIN{} { catch_line = my_function(i) print catch_line print catch_line print catch_line } function my_function(i) { print "echo" line= "awk" line= "gawk"... (2 Replies)
Discussion started by: user_prady
2 Replies

7. Shell Programming and Scripting

need help with User Defined Function

Dear Friends, I need a help regarding User defined function in shell script. My problem is as follows: my_func.sh my_funcI(){ grep 'mystring' I.dat } my_funcQ(){ grep 'mystring' Q.dat } myfuncI myfuncQ But As both the function has same function only the... (11 Replies)
Discussion started by: user_prady
11 Replies

8. UNIX for Advanced & Expert Users

Clearing Shared Memory

Hi, I have various applications on my unix server and one of them relies on a process that needs to start in order to print however the process is not starting at all. I think the problem lies in the shared memory. Does anyone have the commands to flush the shared memory and can anyone tell me if... (2 Replies)
Discussion started by: cipfaadmin
2 Replies

9. Shell Programming and Scripting

Nawk user-defined function

HELP!!!! I am in an on-line shell programming class and have a question. Here is the data: Mike Harrington:(510) 548-1278:250:100:175 Christian Dobbins:(408) 538-2358:155:90:201 Susan Dalsass:(206) 654-6279:250:60:50 (There are 12 contribuors total) This database contains names, phone... (1 Reply)
Discussion started by: NewbieGirl
1 Replies

10. Windows & DOS: Issues & Discussions

Clearing of cache memory

Pls! will someone help me on how to clear my cache memory of my Internet browser Thanks Kayode (3 Replies)
Discussion started by: kayode
3 Replies
Login or Register to Ask a Question
unalias(1)						      General Commands Manual							unalias(1)

NAME
unalias - Removes alias definitions SYNOPSIS
unalias alias-name... unalias -a Note The C shell has a built-in version of the unalias command. If you are using the C shell, and want to guarantee that you are using the com- mand described here, you must specify the full path /usr/bin/unalias. See the csh(1) reference page for a description of the built-in com- mand. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: unalias: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Removes all alias definitions from the current shell execution environment. OPERANDS
The name of an alias to be removed. DESCRIPTION
The unalias utility removes the definition for each alias name specified. The aliases are removed from the current shell execution environ- ment. EXIT STATUS
The following exit values are returned: Successful completion. One of the alias-name operands specified did not represent a valid alias definition, or an error occurred. ENVIRONMENT VARIABLES
The following environment variables affect the execution of unalias: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization variables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale used to affect the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: alias(1), csh(1) Standards: standards(5) unalias(1)