-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

"Dan Bron" <[EMAIL PROTECTED]> writes:

> Oleg's analysis is correct.  I provided a faulty version of bash.  Remove the 
>  ~  from the definition.  Try it now, it should
> work.

Thanks.  I saw Oleg's comment but was too focused on trying other ideas.
That fixed it nicely.  Thank you _very_ much for your help: your change
to task.ijs, your bash'' verb, and your patience.

> Bill: I think some of your problems are caused by lack of knowledge of
> how commands are interpreted.

Could be.  It's been years since I took my week-long intro to HP-UX
courses. 

> You should first understand that quotes are used to keep elements
> atomic.  That is, since the command interpreter cuts on spaces by
> default, and treats each cut like a separate part of the command, we
> need a way to say "ignore the spaces within this part; it is a unified
> whole".

That I get.  I even get there are three types of quotes: '`".  I do
sometimes forget which is which.  I realize (or think) that cmd only
understands ".  

When things didn't work, I sometimes tried escaping (\) spaces, trying
alternative names for c: (/cygdrive/c/ or /c/), or adding or deleting ./
at the start of the command name.  That all came from not realizing that
spawn called cmd when I was starting out.

> So, for example, cmd.exe expects the first part of the command to be
> the filename of the executable to run.  But what is the first part of
> the command?
>
> In  
>
>     C:\>  C:\Program Files\Some Directory\foo.exe  parameter c:\filename 
> containing spaces
>
> Since cmd.exe cuts on spaces by default, the first part of that
> command is "C:\Program".  And, since "C:\Program" isn’t the name of a
> executable, the interpreter complains.  If you were to create a dummy
> executable, name it Program.exe, put it at C:\, and re-run the
> command, you would see Program.exe would be invoked.

That much I think I get.

> In
>
>    C:\>  "C:\Program Files\Some Directory\foo.exe parameter"  c:\filename 
> containing spaces
>
> The first part is "C:\Program Files\Some Directory\foo.exe parameter",
> which again isn’t the name of an executable file.  What you want is
> something like:
>
>   C:\>  "C:\Program Files\Some Directory\foo.exe"  parameter c:\filename 
> containing spaces

That I understand, except that I thought I read someplace that the whole
string including parameter should be quoted, so I tried that, too.  It
obviously didn't work; I hope I'll forget that approach forever.
However, my real problem didn't have a parameter -- only two file names,
one for the executable and one for the input file.

> except for one thing: the command interpreter is AGAIN going to cut on
> spaces by default, and therefore pass four parameters foo.exe:
> "parameter", "C:\filename", "containing", and "spaces".  What you
> intended and and foo.exe expected were that two parameters be passed:
> "parameter" and "c:\filename containing spaces".
>
> Again, to inform the interpreter that despite the embedded spaces, the
> file parameter is a single indivisible unit, you need to surround it
> with quotes:
>
>   C:\>  "C:\Program Files\Some Directory\foo.exe"  parameter "c:\filename 
> containing spaces"
>
> This is what you want and will work.  

That's where I may have confused myself.  I'm pretty sure I did that
multiple times, but, with typing enough long file paths, it's certainly
possibly I could have mistyped something.  What confuses me are the
following sequences:

,----[ No quotes, but it works and complains of missing file (with cmd) ]
| spawn'c:\Documents and Settings\Bill Harris\Desktop\mcsimstd.bass01b'
| 
| ________________________________________
| 
| MCSim v5.0.0
| 
| Copyright (c) 1993-2004 by F. Bois & D. Maszle. All rights reserved.
| 
| MCSim comes with ABSOLUTELY NO WARRANTY;
| This is free software, and you are welcome to redistribute it
| under certain conditions; see the GNU General Public License.
| 
| * Using `bass01b.model' model in file "model.c" created by mod v5.0.0
| 
| Input filename? Error: an input file name must be specified - Exiting
`----

,----[ Same as above but with file name argument; silently doesn't work ]
|    spawn'c:\Documents and Settings\Bill Harris\Desktop\mcsimstd.bass01b 
c:\Documents and Settings\Bill Harris\Desktop\bass01b.test07.in'
| 
| ________________________________________
| 
| MCSim v5.0.0
| 
| Copyright (c) 1993-2004 by F. Bois & D. Maszle. All rights reserved.
| 
| MCSim comes with ABSOLUTELY NO WARRANTY;
| This is free software, and you are welcome to redistribute it
| under certain conditions; see the GNU General Public License.
| 
| * Using `bass01b.model' model in file "model.c" created by mod v5.0.0
`----

,----[ Works as you promised, but I could swear I've tried that ... see below ]
|    spawn'"c:\Documents and Settings\Bill Harris\Desktop\mcsimstd.bass01b" 
"c:\Documents and Settings\Bill Harris\Desktop\bass01b.test07.in"'
| 
| ________________________________________
| 
| MCSim v5.0.0
| 
| Copyright (c) 1993-2004 by F. Bois & D. Maszle. All rights reserved.
| 
| MCSim comes with ABSOLUTELY NO WARRANTY;
| This is free software, and you are welcome to redistribute it
| under certain conditions; see the GNU General Public License.
| 
| * Using `bass01b.model' model in file "model.c" created by mod v5.0.0
| 
| Reading experiment 1.
| Reading experiment 2.
| Reading experiment 3.
| Reading experiment 4.
| Reading experiment 5.
| Reading experiment 6.
| Reading experiment 7.
| Reading experiment 8.
| Reading experiment 9.
| 
| Doing analysis - 9 normal experiments
|  1
|  2
|  3
|  4
|  5
|  6
|  7
|  8
|  9
`----

At this point I am confused.  I could swear that I did the equivalent
yesterday and had it complain.  I tried it with the full path name,
wondering if it was too long, but that worked, too.  Perhaps I had just
stared at it too long yesterday, perhaps I made a typo multiple times
and didn't see it in the history stack, or ...?

At any rate, thanks.  The bash'' verb works well, but it seems that, at
least today, spawn'' does, too.  Case closed.

Bill
- -- 
Bill Harris                      http://facilitatedsystems.com/weblog/
Facilitated Systems                              Everett, WA 98208 USA
http://facilitatedsystems.com/                  phone: +1 425 337-5541
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
Comment: For more information, see http://www.gnupg.org

iD8DBQFF6HGb3J3HaQTDvd8RAt7kAJsGPmLV6DHauxz2xeeNk4a67Ont5QCaA/Bp
o4XQeHHyKGLPTZWbyJ2YGyk=
=GxRQ
-----END PGP SIGNATURE-----

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to