|
![](/i/fill.gif) |
Jim Henderson <nos### [at] nospam com> wrote:
> > For what it's worth, most *nix shells and comand line utilities also
> > have a conniption when it comes to spaces in file names.
> Not if you properly escape them or put the filename in quotes. That's a
> pretty standard practice.
When specifying file names on the command line using wildcards, the shell
will pass file names with spaces in them to the program appropriately.
In shell scripts, however, special care has to be taken to not make
command-line parameters (or even files retrieved using eg. file name
patterns) with spaces in them break the script.
A very common mistake is to write $* in the script to get all the command
line parameters. This will break it for parameters with spaces in them,
as the command where that expansion is used will see them as separate
parameters. The syntax for doing that properly is "$@".
You see this mistake being made all the time, even within high-profile
programs and tools that should know better.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |