avatar
[转载] 再请教高手# Unix - 噫吁兮,危乎高哉
i*r
1
【 以下文字转载自 Linux 讨论区 】
【 原文由 interstellar 所发表 】
I have a directory for certain purpose. Whenever i save a file
to that directory, I need to run a program upon the saved file.
My question is, Can the saving-file event intrigue the invocation
of my program AUTOMATICALLY? If can, how?
thanks!!!
avatar
y*y
2
should be in your "saving" action bah, I don't think the system
can do anything.
are you manually saving or via some program?

【在 i**********r 的大作中提到】
: 【 以下文字转载自 Linux 讨论区 】
: 【 原文由 interstellar 所发表 】
: I have a directory for certain purpose. Whenever i save a file
: to that directory, I need to run a program upon the saved file.
: My question is, Can the saving-file event intrigue the invocation
: of my program AUTOMATICALLY? If can, how?
: thanks!!!

avatar
G*T
3

after the file saved, then trigue another program?
if so, one simple way:
1) check the file's size, if it changes, then
run ur program
else do nothing
2) go to 1. :)
like ur mail notifier

【在 i**********r 的大作中提到】
: 【 以下文字转载自 Linux 讨论区 】
: 【 原文由 interstellar 所发表 】
: I have a directory for certain purpose. Whenever i save a file
: to that directory, I need to run a program upon the saved file.
: My question is, Can the saving-file event intrigue the invocation
: of my program AUTOMATICALLY? If can, how?
: thanks!!!

avatar
i*r
4
What I want to do is like this:
1)I go to www.spaceflightnow.com
2)I download the daily news with the default name index.html
into that directory, using "save as"
Since this page has a very unsatisfying appearance, I wrote a perl
program to extract the text body from index.html to rearrange into
a new html file.
3)go to an xterm, to run the perl program.
Now I want the system to do the third step, so that I don't need to
shift to another window and type in the command---you know, sometim

【在 y***y 的大作中提到】
: should be in your "saving" action bah, I don't think the system
: can do anything.
: are you manually saving or via some program?

avatar
D*N
5
Write a bash script to do everything ah...
wget http://www.spaceflightnow.com/index.html
my_perl_hack index.html
mv index.html `date +%m-%d`.html

【在 i**********r 的大作中提到】
: What I want to do is like this:
: 1)I go to www.spaceflightnow.com
: 2)I download the daily news with the default name index.html
: into that directory, using "save as"
: Since this page has a very unsatisfying appearance, I wrote a perl
: program to extract the text body from index.html to rearrange into
: a new html file.
: 3)go to an xterm, to run the perl program.
: Now I want the system to do the third step, so that I don't need to
: shift to another window and type in the command---you know, sometim

avatar
i*r
6
Thanks,
but my situation is a little bit different. I need to surf
the web before I decide which news to download. When I click on
the link to that news, the address showed is not index.html,
but another unpredictable name. When I try to save-as, the
default name appearing in the dialogue box is index.html

【在 D****N 的大作中提到】
: Write a bash script to do everything ah...
: wget http://www.spaceflightnow.com/index.html
: my_perl_hack index.html
: mv index.html `date +%m-%d`.html

avatar
i*n
7
run this script in your directory
#!/bin/tcsh -f
while(1)
if ( -e index.html) then
your_perl_script index.html
mv -f index.html `date +%d%m_%H%M`.html
else
sleep 60
endif
end

【在 i**********r 的大作中提到】
: Thanks,
: but my situation is a little bit different. I need to surf
: the web before I decide which news to download. When I click on
: the link to that news, the address showed is not index.html,
: but another unpredictable name. When I try to save-as, the
: default name appearing in the dialogue box is index.html

avatar
i*r
8
do you have any concept about the CPU burden
caused by such a script?
I would rather to use crontab,

【在 i*******n 的大作中提到】
: run this script in your directory
: #!/bin/tcsh -f
: while(1)
: if ( -e index.html) then
: your_perl_script index.html
: mv -f index.html `date +%d%m_%H%M`.html
: else
: sleep 60
: endif
: end

avatar
i*n
9

Yes, I have. The answer is: trivial.
Just like that you feel nothing when you invoke xbiff etc.
Please make an investigation about the CPU burden yourself.
Well, you can use whatever you want.

【在 i**********r 的大作中提到】
: do you have any concept about the CPU burden
: caused by such a script?
: I would rather to use crontab,

avatar
i*r
10
Go to tomb, give me a buzz.

【在 i*******n 的大作中提到】
:
: Yes, I have. The answer is: trivial.
: Just like that you feel nothing when you invoke xbiff etc.
: Please make an investigation about the CPU burden yourself.
: Well, you can use whatever you want.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。