Dangerous use of 'rm'

Stephen Allen freebsduk at rowyerboat.com
Tue Jul 11 11:09:57 BST 2006


Thanks a lot Aled.  Just understanding why, is good enough for me.

Cheers,
Steve :)
-- 


Aled Morris wrote:
> I think it is a heritage thing.
> 
> Traditional Unix commands are implemented like this:
> 
> main()
> {
>    while (getopt)
>        process flag
> 
>    if (any remaining arguments) {
>        foreach (remaining arguments)
>            take input from file named "argument"
>    } else {
>       take input from stdin
>     }
> }
> 
> if that makes sense.  "keep it simple" is the idea.
> 
> In english, flags are read first but as soon as the first non-flag is 
> encountered, the rest of the command line is treated as input files (or 
> whatever)
> 
> I would strongly advise against changing this behaviour.
> 
> Aled





More information about the Ukfreebsd mailing list