[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

some function problems



hi all

i'm new to linux, just starting to learn, and have some problems:
1. how do i write a function that gets as an argument a name of a 
directory and prints in depth?
2. i have written a function that is supposed to give me the 
file/directory with the biggest name
   but it doen't work.
   after the for ends the variables return to their initial value.
   why (the function hasnt ended yet and in compere to c they are global 
ones in the function)
   so here is the function:
   maxname () { name=0 ; max=-1; for x in $(ls -1d *); do test $(ls -1d 
$x|wc -c|tr -d ' ') -gt $max && (max=$(ls -1d $x|wc -c|tr -d ' '); 
name=$x; echo found a bigger one   max is $max and the name is $name); 
done; echo $name $max }
   
thanks,

alon kadury
kadury@hotmail.com
Get Your Private, Free Email at http://www.hotmail.com