Sponsored Content
Full Discussion: rm question
Top Forums UNIX for Dummies Questions & Answers rm question Post 302098343 by SeanWuzHere on Saturday 2nd of December 2006 07:59:08 PM
Old 12-02-2006
Quote:
Originally Posted by System Shock
Let me get this straight.
You want to set a variable that will limit the number of files you can delete in the command line, ex:
if you set MAXFILES to 3, and you type something like
Code:
 delete file1 file2 file3 file4 file5

only file1 file2, and file3 will be deleted.

Is that what you are looking for?
Yeah. Something like that. Here is the code I have so far for the program. It kinda sorta works but either I'm doing something wrong or it's missing something or I dunno.


Code:
#!/bin/bash
# Program: myrm

if [ "$#" -le 0 ]
then
        echo "Not enough arguments"
        echo "Usage: myrm [arg1] [arg2] etc..."
        exit 1
fi

MAXFILES=""
FILECOUNT=$(ls | wc -l)

if [ -n "$MAXFILES" ]
then

        if [ "$FILECOUNT" = "$MAXFILES" ]
        then
                for i
                do
                        rm -rf $1
                        shift
                done

        elif [ "$MAXFILES" > "$FILECOUNT" ]
        then
                echo "Would you like to delete these files?"
                read choice

                case "$choice"
                in
                        y)      for i; do rm -rf $1; shift; done;;
                        n)      echo "Thank you, have a nice day";;
                        *)      echo "Invalid choice"
                                exit 2;;
                esac
        fi

elif [ -z "$MAXFILES" ]
then
        for i in $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10}
        do
                rm -rf $1
                shift
        done
        exit 0


fi

 

7 More Discussions You Might Find Interesting

1. Programming

Yet Another Question

Now that I have getch() to work, I have yet another problem. BTW, thank you for answering these questions, I do ask a lot, only because I am eager to know, what is a board used for anyways :) Ok, he's the problem... #include iostream.h #include conio.h int main() { char movement; ... (2 Replies)
Discussion started by: mbolthouse
2 Replies

2. Solaris

vi question

Im trying to edit a 113 meg file in VI and i get the error TMP FILE TOO LARGE. Does someone know how to get around this? Thanks! (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

3. UNIX for Dummies Questions & Answers

mv question

Hello if I like to move file from defined directories system to new directory that not contained any directories system structure . But I like to create the same file system structure as source directory for example : I have 2 directories: foo1 and foo2 foo1 have directories and foo2 have... (2 Replies)
Discussion started by: umen
2 Replies

4. UNIX for Dummies Questions & Answers

Question

hallo, ik heb hier een vraagje. hoeveel gebruikers kunnen er op 1 unix systeem. hopelijk antwoorden golle nu want ik moet da vinde voor school en die leerkracht zaagt. :p groetjes eu wacht wa was mijne nick ah ja vraagje groetjes vraagje ik kan geen engels dus antwoord liever in het... (1 Reply)
Discussion started by: vraagje
1 Replies

5. Shell Programming and Scripting

question about wc

Hey my friend was asking me if i knew a way to cout how many different words in a file. I told him no not off hand, but i was thinking about it, and i started to wonder also. I imagine this is probably pretty simple im just missing something, I keep confusing my self with how you would compair and... (16 Replies)
Discussion started by: yodadbl07
16 Replies

6. Hardware

question

How to add 3 moniters to a pc set up? (2 Replies)
Discussion started by: clicstic
2 Replies

7. AIX

df question

Hi, Can anyone please explain a little about df command. I have following question: Following example is showing % used as 4 where as total free blocks are 15.46 out of 16.00 MB blocks. df -m /test Filesystem MBblocks Free %Used Iused %Iused ... (5 Replies)
Discussion started by: itsabhi9
5 Replies
asadmin-delete-acl(1AS) 					   User Commands					   asadmin-delete-acl(1AS)

NAME
delete-acl - removes the access control list file SYNOPSIS
delete-acl --user admin_user[--password admin_password][--host localhost] [--port 4848][--passwordfile filename][--secure|-s][--instance instance_name] acl_ID Gets the access control lists associated with the named server instance.. OPTIONS
--user administrative user associated for the instance. --password administrative password corresponding to the administrative user. --host host name of the machine hosting the administrative instance. --port administrative port number associated with the administrative host. --secure indicates communication with the administrative instance in secured mode. --passwordfile file containing passwords appropriate for the command (e.g., administrative instance). --instance name of the instance. OPERANDS
acl_ID internal name for the ACL file listing. This ID is used in a virtual server element to define the ACL file used by the virtual server. Example 1: Using delete-acl asadmin> delete-acl --user admin --password adminadmin --host fuyako --port 7070 --instance server1 sampleACL Deleted ACL with id = sampleACL Where: sampleACL is the ACL that is deleted. EXIT STATUS
0 command executed successfully 1 error in executing the command INTERFACE EQUIVALENT
Access Control List page asadmin-create-acl(1AS), asadmin-list-acl(1AS) J2EE 1.4 SDK March 2004 asadmin-delete-acl(1AS)
All times are GMT -4. The time now is 03:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy