Sponsored Content
Full Discussion: hi friends..........
Top Forums Shell Programming and Scripting hi friends.......... Post 302234708 by newson on Wednesday 10th of September 2008 07:18:12 AM
Old 09-10-2008
Bug hi friends..........

hello friends ........
i want to visit the directory recusvely through and shell script . and want to get the output of " stat " command for each file .i tried by this way but unable to visit the each file .

#!/bin/bash
echo "enter the file name"
read file
fun()
{
ls $file >file_store1
while read i
do
if [ -d $i ]
then
cd $i
fun ;
else
stat $i
fi
done < file_store
}
fun ;

i want some thing like this ..
if suppose there is directory

dir --> file1 file2 dir1 dir2 dir3 file3
and if inside dir1--> file11 file12 dir11 dir12
and inside dir11 -->file111 file112
then i want to get the output for every file of-------- stat------------command
like for fil1 file2 file11 file12 file111 and so ..on ........

Last edited by newson; 09-10-2008 at 08:30 AM.. Reason: there was a error in code
 

5 More Discussions You Might Find Interesting

1. IP Networking

hi friends

i have been in trouble please help me out i have developed a message queue.it is a simple message queue program after running it give error like NO SPACE LEFT ON DEVICE what is this error how could i solve this problem i am working on solaris9.2 (2 Replies)
Discussion started by: ramneek
2 Replies

2. Shell Programming and Scripting

hi friends....

hi friend i am facing problem in taking input from a file to the variable .. read fname if then cd $fname pwd ls > new_temp1 cat new_temp1 fi terminal=`tty` exec < $new_temp1 while read line do echo $line done exec < $terminal (2 Replies)
Discussion started by: newson
2 Replies

3. UNIX for Advanced & Expert Users

hello friends

:confused: i'am new to this unix environment.can any one give guidence in how to c programs for inter communication process (4 Replies)
Discussion started by: shaffiullabaig
4 Replies

4. What is on Your Mind?

Time to have FUN my Unix/Linux friends...(One liners)...MUST read.. !!

As a mind refresher, I was thinking to start a new thread for ONE LINERS....funny/weird or any technical one liners.... Let me start first...... ================================= #!/bin/ssh #The Unix Guru's View of Sex unzip ; strip ; touch ; grep ; finger ; mount ; fsck ; more ; yes ;... (3 Replies)
Discussion started by: Rahulpict
3 Replies

5. What is on Your Mind?

You Want to Spend Time with Friends and Family a UNIX.com Cartoon Explainer

Well, this was kinda fun and different: You Want to Spend Time with Friends and Family a UNIX.com Cartoon Explainer https://youtu.be/6jPDpuxI2OA You want to spend time with friends and family. But you are stuck on some problem... Your Linux or Unix code is buggy and you don't know... (1 Reply)
Discussion started by: Neo
1 Replies
PIDOF(8)						Linux System Administrator's Manual						  PIDOF(8)

NAME
pidof -- find the process ID of a running program. SYNOPSIS
pidof [-s] [-c] [-n] [-x] [-o omitpid[,omitpid..]] [-o omitpid[,omitpid..]..] program [program..] DESCRIPTION
Pidof finds the process id's (pids) of the named programs. It prints those id's on the standard output. This program is on some systems used in run-level change scripts, especially when the system has a System-V like rc structure. In that case these scripts are located in /etc/rc?.d, where ? is the runlevel. If the system has a start-stop-daemon (8) program that should be used instead. OPTIONS
-s Single shot - this instructs the program to only return one pid. -c Only return process ids that are running with the same root directory. This option is ignored for non-root users, as they will be unable to check the current root directory of processes they do not own. -n Avoid stat(2) system function call on all binaries which are located on network based file systems like NFS. Instead of using this option the the variable PIDOF_NETFS may be set and exported. -x Scripts too - this causes the program to also return process id's of shells running the named scripts. -o omitpid Tells pidof to omit processes with that process id. The special pid %PPID can be used to name the parent process of the pidof pro- gram, in other words the calling shell or shell script. EXIT STATUS
0 At least one program was found with the requested name. 1 No program was found with the requested name. NOTES
pidof is actually the same program as killall5; the program behaves according to the name under which it is called. When pidof is invoked with a full pathname to the program it should find the pid of, it is reasonably safe. Otherwise it is possible that it returns pids of running programs that happen to have the same name as the program you're after but are actually other programs. Note that that the executable name of running processes is calculated with readlink(2), so symbolic links to executables will also match. SEE ALSO
shutdown(8), init(8), halt(8), reboot(8), killall5(8) AUTHOR
Miquel van Smoorenburg, miquels@cistron.nl 01 Sep 1998 PIDOF(8)
All times are GMT -4. The time now is 07:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy