I want to use the rm command to delete files in a directory. But I want to be able to set a variable that says how many arguments it will delete. So for instance, if I set a variable to null,.. (i.e. MAXFILES="") then it will just delete all the arguments. But if I set MAXFILES=2 for instance, then it will delete only 2 arguments. I'm writing a program to do this, and there are other specifications too,.. but I think I have most of it figured out but I can't seem to get past this one hurdle. Any thoughts? Great thanks in advance to any advice on this.
Btw,... before I start writing the program, I want to be able to practice setting the variable and then using that variable just using the command at the command prompt. In other words, I want to be able to just do something like...
$ MAXFILES=""
$ rm arg1 arg2 arg3
$
or
$ MAXFILES=2
$ rm somethinggoeshere (and it deletes the files per the number of arguments defined in the variable above.)
This way it will hopefully sink in through my thick cranium on how this is working.