3 ms·
Please define "argument expansion".
by ralph 14y ago
Please define "argument expansion".
- calpaterson 14y agoIn many (all?) unix shells, globs are expanded by the shell before being passed to the program. 'ls *.jpg' is passed expanded to 'ls 1.jpg 2.jpg 3.jpg' BEFORE ls is run. This choice means that if a program wants to use another style of regular expression (ie: pcre), it must be enclosed in quotes on the shell, ie: "ls | grep -P '.*jpg'"
- ralph 14y agoYes, that's globbing, but I was wondering what the OP meant by argument expansion. It could be just globbing, or include globbing but extend to variable expansion, braces, command substitution... It's hard to put a case that having the shell do these things is the right way to do it without understanding the OP's point clearly.
- tedunangst 14y agoMinor point: if the glob doesn't match it isn't expanded. Sometimes useful. I rarely escape scp commands for instance.
- ralph 14y agoSee `failglob' elsewhere on this page. What you suggest is sometimes useful but also sometimes wrong and hard to spot because the glob might match locally and one not realise.