On 3/16/2017 2:13 PM, Carlos E. R. wrote:
On 2017-03-16 18:04, David Haller wrote:
Hello,
*Gah* Don't you learn the absolute basics of the shell you use anymore?
Why in the world should rm act otherwise when you call it with the '-i' option? No matter if you typed the -i or if it is the result of globbing?
Well, no, I was not aware of this. And I have been using the Linux shell bash for almost two decades.
I thought, without thinking, that the command would differentiate between options and filenames automatically. No, it is not so, not in Linux. The shell expands the '*' and gets all options and filenames as just strings in the same command line. MsDos doesn't get this confusion, it is the app which has to do the expansion after it parses the command line.
Sorry, but shell expansion is basics. If you managed to go 20 years without knowing how the shell works, that doesn't mean it was secret hidden unfathomable knowledge. The fault is yours not the shells. And the windows cmd command line parsing is absolutely terrible example. You may not understand or like the rules that all of the unix shells follow, but the at least have rules, which they follow, and which are consistent and predictable and allow you to express anything you need. The same is NOT true of cmd.exe. The quoting and command line parsing rules for that were drawn by kindergarteners in crayon. --- To launch a batch script with spaces in the Program Path requiring "quotes" CMD /k ""c:\batch files\test.cmd" "Parameter 1 with space" "Parameter2 with space"" --- That is some amazing embarassing stuff right there. If a developer brought that to me I wouldn't fire them, but they'd sure know that they failed to meet a pretty low bar. And yet, sucky as that is, When I had to write some windows software that needed to run a program, from cmd.exe from within an execve(), and then that had to be run from a registry entry, which recieved commandline arguments from a URL... I found the docs and learned how it works. Quoting, escaping, globbing, and the way those all behave in different contexts and interact with each other, including nested within each other, these are all simply required understanding to use the system in any better way than guessing and luck. Otherwise you will never know what will happen with any command you ever write, and you will hit exactly what you hit. -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org