Unix Wildcards Gone Wild
defensecode.com
Unix Wildcards Gone Wild
1–10 of 54 posts
Re: Unix Wildcards Gone Wild
#2[0] http://pubs.opengroup.org/onlinepubs/9699919799/functions/ge...
Re: Unix Wildcards Gone Wild
#3Re: Unix Wildcards Gone Wild
#4Good summary of surprising behavior. You can work around a lot of these issues using "--" as an argument before you use any wildcards. This tells most commands to stop processing options and treat the rest of the arguments as files (or whatever other non-option arguments the command takes). That's getopt(3)'s behavior[0]. For example, "rm -- *" will not have the problem where directories are removed if there's an ent…
Re: Unix Wildcards Gone Wild
#5http://www.dwheeler.com/essays/filenames-in-shell.html
I strongly recommend his many other essays to HN readers: http://www.dwheeler.com/
Edit: a simple way to avoid these problems is to prepend the wildcard with ./ (so globbed files won't start with - or -- but with the path ./) and on GNU systems put -- before the wildcard, telling the tool that following arguments are not options.
Re: Unix Wildcards Gone Wild
#6Re: Unix Wildcards Gone Wild
#7Re: Unix Wildcards Gone Wild
#8Re: Unix Wildcards Gone Wild
#9I think if you have the ability to create new files on a remote host, you are already compromised. No need to wait for an Admin mistake.
Re: Unix Wildcards Gone Wild
#10I think if you have the ability to create new files on a remote host, you are already compromised. No need to wait for an Admin mistake.