On Wed, May 03, 2017 at 10:22:57PM +0200, to...@tuxteam.de wrote: > FWIW, a trick to see what's really going on is to prepend an echo > before all that: > > echo find /home/richard -type d -name .* > > (for the example above). Of course you won't think of that if you > are't suspecting shell expansion in the first place, but I find > it very instructive to see what the shell is "seeing". That'll > help memory for the next time (it does for me, at least).
Yeah, that's a good start. I actually have a little script I wrote, called "args": wooledg:~$ cat bin/args #!/bin/sh printf "%d args:" "$#" printf " <%s>" "$@" echo It's similar to echo, but gives a bit more feedback. wooledg:~$ args echo *.txt 6 args: <echo> <equipment.txt> <gistfile1.txt> <items.txt> <rename.pl.txt> <TWL06.txt> wooledg:~$ args "" '' '{}' '"' "'" 5 args: <> <> <{}> <"> <'> Yet another basic tool you can use for certain kinds of analysis. Like, when you're learning just how bad ssh is at certain things like preserving arguments: wooledg:~$ ssh localhost bin/args echo "a quoted string with spaces" wooledg@localhost's password: 6 args: <echo> <a> <quoted> <string> <with> <spaces> "Oh, so THAT'S why it's breaking!" (cf. http://mywiki.wooledge.org/BashFAQ/096)