由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - shell programming
相关主题
perl Q[转载] 问个shell怎么写?
Korn shell scripthow to count # of output in shell
关于perl和linux shell script的书最经典有哪些? (转载)A question about cron job
[转载] Re: shell script question如何在perl中运行c-shell file?
shell script for "for" loopHow to monitor peak memory usage?
login shell and normal shell?Perl问题求助 (转载)
how to change login shell?how to know which shell the system is using
how to redirect error output under unixCGI之Perl Script一问
相关话题的讨论汇总
话题: app1话题: lsof话题: shell话题: output话题: script
进入Unix版参与讨论
1 (共1页)
d*o
发帖数: 108
1
I have an Java application, say, called 'app1'. I want to write
a B shell script to invoke it. the reason to do that is to
record how many files 'app1' opened by useing 'lsof'. Problems:
1. how to record the output of 'lsof'?
(for example, if it is in Perl, I can do $output = `lsof`. what
is the counterpart in shell script?)
2. in the end of my shell script, I'll invoke the program 'app1'
by just say 'app1'. How can I use 'lsof' again _AFTER_ 'app1'
is running?
one way is to write like this:
app
p*a
发帖数: 592
2

output=`lsof`
looping=1
app1 &
while [ looping ]
do
sleep 120
output=`lsof`
echo "# of files opened: $output"
# some condition to set looping variable
...
done


【在 d*o 的大作中提到】
: I have an Java application, say, called 'app1'. I want to write
: a B shell script to invoke it. the reason to do that is to
: record how many files 'app1' opened by useing 'lsof'. Problems:
: 1. how to record the output of 'lsof'?
: (for example, if it is in Perl, I can do $output = `lsof`. what
: is the counterpart in shell script?)
: 2. in the end of my shell script, I'll invoke the program 'app1'
: by just say 'app1'. How can I use 'lsof' again _AFTER_ 'app1'
: is running?
: one way is to write like this:

d*o
发帖数: 108
3
very, very appreciate your help. Thanks a lot!

【在 p*a 的大作中提到】
:
: output=`lsof`
: looping=1
: app1 &
: while [ looping ]
: do
: sleep 120
: output=`lsof`
: echo "# of files opened: $output"
: # some condition to set looping variable

1 (共1页)
进入Unix版参与讨论
相关主题
CGI之Perl Script一问shell script for "for" loop
[转载] Perl高手请进login shell and normal shell?
文件删不掉how to change login shell?
please help, CGI..how to redirect error output under unix
perl Q[转载] 问个shell怎么写?
Korn shell scripthow to count # of output in shell
关于perl和linux shell script的书最经典有哪些? (转载)A question about cron job
[转载] Re: shell script question如何在perl中运行c-shell file?
相关话题的讨论汇总
话题: app1话题: lsof话题: shell话题: output话题: script