![]() |
|
|
grep unix.com with google
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Our Members | Calendar | 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 and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
Eliminating output?
Hi Folks, I am writting a shell script for general purpose use.... i have created a function like below:- Code:
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...
|
|
|||
|
I haven't tested but this should work: Code:
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 Last edited by pludi; 12-01-2009 at 02:17 PM.. Reason: code tags, please... |
|
|||
|
excellent that works
cheers!!! |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Eliminating paging space and interpreting memory utilization | depam | AIX | 1 | 07-29-2009 07:30 PM |
| Eliminating duplicates from the who command | mikejreading | Shell Programming and Scripting | 9 | 03-17-2009 01:12 PM |
| Eliminating CR (new lines) from a file. | KornFire | UNIX for Dummies Questions & Answers | 4 | 01-29-2009 06:06 AM |
| Eliminating characters between two expressions | arsheshadri | HP-UX | 1 | 06-26-2008 09:00 AM |
| Eliminating whitespaces during reading of a field. | videsh77 | Shell Programming and Scripting | 4 | 12-13-2004 12:52 PM |