Basic script writing in a Korn shell

Basic script writing in a Korn shell

Post by pjame » Thu, 07 Oct 1999 04:00:00



I am brand new to unix and I need to write a script to check a directory and
notify me if there are more than x number of files.

I am on AIX version 4 and am using the korn shell. (I didn't even know these
words before today)

I cannot get "ed" to work right. Can I write it in notepad as a startup
script for Novell's Host Presenter?

Please respond assuming I know nothing, cause I'm not far from it.

Thanks

 
 
 

Basic script writing in a Korn shell

Post by John Hawkin » Fri, 08 Oct 1999 04:00:00


Use "vi" or "emacs" editors or, if you are running the CDE gui, use the text
editor provided - its similar to notepad.

The output from "ls -a | wc -l" will tell you the number of files in a
directory.  Simply compare this number with your threshold and then mail you
should it exceed.


>I am brand new to unix and I need to write a script to check a directory
and
>notify me if there are more than x number of files.

>I am on AIX version 4 and am using the korn shell. (I didn't even know
these
>words before today)

>I cannot get "ed" to work right. Can I write it in notepad as a startup
>script for Novell's Host Presenter?

>Please respond assuming I know nothing, cause I'm not far from it.

>Thanks


 
 
 

1. Urgent! Please help with basic Korn shell script!

I want to write a shell script that will take an optional parameter
which is a directory name and display information about the current directory
(or the specified directory if one is listed as a parameter).  The information
given should be in the format given below.  If any zero byte files are
detected in the current directory, then the program should ask the user
if (s)he wants to delete them.  After displaying the information and allowing
for zero byte file deletions, the shell should ask the user if they would
like to see information for a different directory and perform the necessary
actions.

DISPLAYED BELOW IS THE OUTPUT FORMAT THAT I WANT THE SCRIPT TO USE
user input is specified all in caps (though in reality it is in lower case)

  The current directory is /pub/walczak/unix

  This directory contains:
         1  directories
         28  files, of which  5  are programs or executable files
         1  files which have no data (0 bytes)

rm: remove zero? N

Would you like to see another directory? Y
Current directory is /pub/walczak/unix
Which directory would you like to see? ZSHELLTEST
----AT THIS POINT A CLEAR SCREEN SHOULD APPEAR
  The current directory is /pub/walczak/unix/zshelltest

  This directory contains:
         0  directories
         8  files, of which  5  are programs or executable files
         2  files which have no data (0 bytes)

rm: remove zero2? N
rm: remove zero3? Y

Would you like to see another directory? Y

Current directory is /pub/walczak/unix/zshelltest
Which directory would you like to see? ../.. (SORRY, COULDN'T DO THIS IN CAPS)
AGAIN
  The current directory is /pub/walczak

  This directory contains:
         4  directories
         0  files, of which  0  are programs or executable files
         0  files which have no data (0 bytes)

Would you like to see another directory? N

Please E-mail result if possible.

Thanks,

Mark Jones

2. xmcd: disk busy :-(

3. Help: MUSTEK scanner, SCSI

4. Q: dial on demand

5. Convert Bash shell script to Korn shell script

6. IX3D Ultimate Rez 8MB

7. help help help to write a script in korn shell

8. Need Help writing a complex Korn Shell Script

9. Help to write a script in korn shell

10. best korn shell resources and is there a korn shell faq

11. c-shell script won't run from korn-shell / SETUID