Eliminating output?

Hi Folks,

I am writting a shell script for general purpose use....

i have created a function like below:-

 
largest_file()
{
clear
tput cup 20 30
echo please enter the full directory path where you want to search:-
tput cup 21 30
read lr_choice1
tput cup 22 30
echo please enter the no of files you want to get:-
tput cup 23 30
read lr_choice2
cd $lr_choice1
find $lr_choice1 -type f -print | xargs ls -l | sort -k5,5rn | head -"$lr_choice2" > 
$script_dir/top_$lr_choice2_file_$date_var.txt
tput clear
tput cup 20 0
cat $script_dir/top_$lr_choice2_file_$date_var.txt
tput cup 25 0
echo press hit to continue
read hit
}
 
 

I call the function in a interactive shell script for displaying the n largest file in a directory..

Now when i call this function in a switch case programme.....i dont want to show the output generated by the find command .....i just want end results....

like if i call the function it should write only to the file and not stdoutput for operation so that user shouldn't know what happening...

your help is appreciated... :slight_smile:

I haven't tested but this should work:

find $lr_choice1 -type f -print | xargs ls -l | sort -k5,5rn | head -"$lr_choice2" > 
$script_dir/top_$lr_choice2_file_$date_var.txt 2>/dev/null
find $lr_choice1 -type f -exec ls -s {} \; |sort -nr |head -"$lr_choice2" 

excellent that works

cheers!!!