Imagine you have a directory that contains several hundreds of files and for what reason ever you want to list all files in this directory except one or even worse a couple of them.
This sounds easy, but actually isn't. Let me illustrate the situation:
Now say I want to get a listing of all files except confidential.txt. Of course, one could use sed or grep to do this but this is too much overhead as I don't want to waste resources.
There are a couple of solutions all with certain drawbacks:
- Solution #1 - bad:
- Solution #2 - not so bad:
- Solution #3 - good:
You may have noticed that '!' now has a different meaning (it is normally used to repeat old commands), which is its only drawback.
- Solution #4 - the best, IMHO: