Bourne Shell

Posted on 1998-12-14
Last Modified: 2013-12-26
my question is

create a shell script called DELSTAR which will accept input, and then check if the input is a directory file and is readable and writable. If so, then all the ordinary files under the diirectory should be listed out one by one.For each ordinary file that is writeable, the user should be ask if the file is to be deleted or not. If yes, theb the deletion should be done, else the next file processed.
At the end of the execution, the script should display the following message:
_________ordinary files deleted from the directory
_________ordinary files remaining in the directory

(From eugene)
age:18(IT Student)
Question by:sumbat31
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 51

Accepted Solution

ahoffmann earned 200 total points
ID: 1294836
#! /bin/sh
# check for symbolic links may be different on your OS
if [ $# -lt 0 ]; then
   echo 'schoolworks are usually done yourself :-)'
   exit 1;
if [ -d $dir -a -r $dir -a -w $dir ]; then
   cd $dir
   for f in `ls`; do
        if [ -L $f ]; then
        if [ -f $f ]; then
            cnt=`expr $cnt + 1`
            rm -i $f
   for f in `ls`; do
        if [ -L $f ]; then
        if [ -f $f ]; then
            rem=`expr $rem + 1`
   del=`expr $cnt - $ rem`
   echo $cnt ordinary files deleted
   echo ordinary files remaining $rem
   exit 2;


Author Comment

ID: 1294837
You did a fine job

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 85
C++ BOOL WINAPI ReadFile fails on windows 10 when reading from USB cable 9 519
dog bark java program 15 121
fizzArray2 challenge 1 102
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question