Forum Moderators: bakedjake

Message Too Old, No Replies

shell scripting, just running commands

can this be done very easily?

         

Clark

6:13 pm on May 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I don't know much about scripting. I wrote a shell script that started with

#/bin/somethingorother/sh

and I basically used someone else's code and figured out how to get done what I need done. But now I'm starting from scratch and this is what I want to do from the command line, but put into a file and run in a cron job:
---------
Date >>/filename.txt
grep something /path/to/file -c >>/filename.txt
grep something /path/to/file >>/filename.txt

----------

Can someone tell me how to do this in unix?
Thanks!

Brett_Tabke

3:41 pm on May 11, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Well, you call it simply with the name on the command line. As for the cron part, that's also fairly easy to do. There are quite a few good back cron threads:

[google.com...]

bird

1:15 pm on May 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your example looks fine and should basically work as given.

The only thing to add to Bretts comments is that you first need to give execute rights to your script file, so that the system knows that it is allowed to execute it:

$> chmod a+x yourscriptfile