Unloading all functions from cache


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unloading all functions from cache
# 1  
Old 03-02-2010
Unloading all functions from cache

Hi

I have a following function that i call from my main script in korn shell.

#Unset all functions from the cache

Code:
#/bin/ksh
#Unset all functions from the cache

init () {
for func in "$(ls)"
do
  echo "$func" 
  unset -f $func

if [$? -ne 0] ; then
return 1
fi

done 

}


I want to know how to unit test this functions individually ?
As my main function just calls many functions like this.

if i go to directory and run init all by itself on command line i get

ksh[4]: unset: 0403-008 The number of parameters specified is not correct.

Any ideas on what i am doing wrong
# 2  
Old 03-02-2010
1) Recommend that you do not call a script or a function "init". It is the name of the fundamental unix program which runs at the top of the process tree.

2) As posted the script does nothing. It is just a function and there is no code to call the function. There is also no code to put a value into "$ls" should someone call the function.

What did you type on the command line?
What is actually in the script?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Question on selling/unloading Sunfire V240

Over 6 years ago I picked up a Sunfire V240 from my employer who was unloading all of their Sun hardware. Two processors, 4GB RAM and half dozen SCSI disk drives. It doesn't have an OS or a CD Rom/DVD drive. I have a collection of SCSI drives that should work with the server. So if I can get... (2 Replies)
Discussion started by: gandolf989
2 Replies

2. Shell Programming and Scripting

How to execute functions or initiate functions as command line parameters for below requirement?

I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line if then... (8 Replies)
Discussion started by: saku
8 Replies

3. Linux

Linux cache

Hi, We are working on OEL5.7 (Oracle Linux) OS. We have a server with 64GB RAM. When we issue free -m command which shows the used, available and cached space. Most of the space is shown in cached section, where as we are not really doing much activity on the server. It's like cached is... (5 Replies)
Discussion started by: shrshah64
5 Replies

4. Linux

File cache /Page cache Linux

Hi All, could any one point out any open source test-suites for "File cache" testing and as well as performance test suites for the same. Currently my system is up with Linux/ext4. Regards Manish (0 Replies)
Discussion started by: hmanish
0 Replies

5. Linux

getting info on Cache Size, Data Cache etc..

Hi all I saw in Microsoft web site www.SysInternals.com a tool called CoreInfo from able to print out on screen the size of the Data and Instruction caches of your processor, the Locigal to Physical Processor mapping, the number of the CPU sockets. etc.. Do you know if in Linux is available a... (2 Replies)
Discussion started by: manustone
2 Replies

6. Linux

Linux cache

Hi all I am trying to understand the kernel memory management and require assistance in this regard. Kernel first creates the cache memory to perform any subsequent allocation to processes. I could not figure out how it is accomplished. Do kernel directly allocates any hardware cache or allocates... (0 Replies)
Discussion started by: joshighanshyam
0 Replies

7. HP-UX

Buffer Cache

What is the "Buffer Cache" used for? (1 Reply)
Discussion started by: ALTRUNVRSOFLN
1 Replies

8. UNIX for Advanced & Expert Users

vm and buffer cache

i have a serious doubht about the assignment of memory in hp-ux system . i read from somewhere that the page allocation in hp-ux is not unified unlike compaq . i wanted to know in hp-ux kernel ,once the pages are assigned for the univarsal buffer cache... (2 Replies)
Discussion started by: vish_shan
2 Replies

9. UNIX for Advanced & Expert Users

UBC cache vs. Metadata cache

hi, What is the difference between UBC cache and Metadata cache ? where can i find UBC cache Hits and Metadata cache Hits in hp-ux? Advanced thanx for the help. (2 Replies)
Discussion started by: sushaga
2 Replies

10. Shell Programming and Scripting

unloading sql query to file

In unload to "/usr/home/data.012202" I wish to use a date variable as in unload to "/usr/home/data.`date`" for the file is that possible in a query to do, or will i need to add a mv command after the query to do it. I tried backquotes, , and () on `date` but didn't seem to work Thanks... (2 Replies)
Discussion started by: Link_02
2 Replies
Login or Register to Ask a Question