[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

"myscript.rb " - there's a blank in my name!

Todd Burch

9/24/2007 5:55:00 AM

On a Mac - Tiger 10.4.10.

I wrote a ruby script in TextWrangler (2.2.1) and saved it. I
inadvertently hit the space bar after the ".rb" and saved it. Then, not
realizing a blank got added to the name, I attempted to run it and it
could not be found. After messing with it, I realized the blank was
saved as the third character after the "b" in .rb.

Running

ruby myscript.rb

failed.

Running

ruby "myscript.rb "

worked. Is this a Mac thing? I've nevver know a blank character at the
end of a file name to be significant.

Todd
--
Posted via http://www.ruby-....

12 Answers

Todd Burch

9/24/2007 5:56:00 AM

0

Todd Burch wrote:

> I've nevver know a blank character at the
> end of a file name to be significant.
>
"never known" ... sorry.
--
Posted via http://www.ruby-....

Konrad Meyer

9/24/2007 6:04:00 AM

0

Quoth Todd Burch:
> Todd Burch wrote:
>
> > I've nevver know a blank character at the
> > end of a file name to be significant.
> >
> "never known" ... sorry.

Yes, on *nix systems this is significant (probably windows too, I'm just
unfamiliar with it). You can also do "ruby myprog.rb\ " to escape the space.

HTH,
--
Konrad Meyer <konrad@tylerc.org> http://konrad.sobertil...

John Joyce

9/24/2007 6:06:00 AM

0

Mac OS (before X even) respects spaces in file names. At the
beginning and at the end.
It's not the only *nix that does.

On Sep 24, 2007, at 12:54 AM, Todd Burch wrote:

> On a Mac - Tiger 10.4.10.
>
> I wrote a ruby script in TextWrangler (2.2.1) and saved it. I
> inadvertently hit the space bar after the ".rb" and saved it.
> Then, not
> realizing a blank got added to the name, I attempted to run it and it
> could not be found. After messing with it, I realized the blank was
> saved as the third character after the "b" in .rb.
>
> Running
>
> ruby myscript.rb
>
> failed.
>
> Running
>
> ruby "myscript.rb "
>
> worked. Is this a Mac thing? I've nevver know a blank character
> at the
> end of a file name to be significant.
>
> Todd
> --
> Posted via http://www.ruby-....
>


Todd Burch

9/24/2007 6:48:00 AM

0

John Joyce wrote:
> Mac OS (before X even) respects spaces in file names. At the
> beginning and at the end.
> It's not the only *nix that does.

Wow. Who would have thunk. I gotta watch that fat thumb from now on.

Thanks guys.

Todd
--
Posted via http://www.ruby-....

Sebastian Hungerecker

9/24/2007 7:59:00 AM

0

Todd Burch wrote:
> After messing with it, I realized the blank was
> saved as the third character after the "b" in .rb.
>
> Running
> ruby myscript.rb
> failed.
>
> Running
> ruby "myscript.rb "
> worked.

You know you should really use tab completion. It saves a lot of typing and in
cases where the filename isn't exactly what you think it is it helps you find
the problem a lot faster.


--
Jabber: sepp2k@jabber.org
ICQ: 205544826

Shai Rosenfeld

9/24/2007 8:40:00 AM

0

> You know you should really use tab completion. It saves a lot of typing
> and in
> cases where the filename isn't exactly what you think it is it helps you
> find
> the problem a lot faster.

here here on the tab suggestion; i personally couldn't work without it
--
Posted via http://www.ruby-....

Chad Perrin

9/24/2007 2:53:00 PM

0

On Mon, Sep 24, 2007 at 03:04:27PM +0900, Konrad Meyer wrote:
> Quoth Todd Burch:
> > Todd Burch wrote:
> >
> > > I've nevver know a blank character at the
> > > end of a file name to be significant.
> > >
> > "never known" ... sorry.
>
> Yes, on *nix systems this is significant (probably windows too, I'm just
> unfamiliar with it). You can also do "ruby myprog.rb\ " to escape the space.

If I'm not mistaken, MacOS X uses bash as its default shell. That would
mean you don't actually need to escape the space if you use quotes:

$ ruby "myprog.rb "

The same is true of (t)csh:

> ruby 'myprog.rb '

In either shell, whether you use single or double quotes doesn't matter,
and escaping the space (without quotes) also works.

Whether or not the space is significant when first naming the file
depends on how you name it. I believe that is true on MS Windows as well
as systems such as MacOS X, various Linux distributions, SysV and BSD
Unix systems, and so on -- though I don't have an MS Windows machine in
front of me to test it. An extra space after a filename shouldn't
produce a space character in the the filename itself when entered at a
command line shell, but will probably do so with certain GUI-oriented
means of naming files.

--
CCD CopyWrite Chad Perrin [ http://ccd.ap... ]
McCloctnick the Lucid: "The first rule of magic is simple. Don't waste your
time waving your hands and hopping when a rock or a club will do."

John Joyce

9/24/2007 3:31:00 PM

0

yes, OS X 10.4 and upcoming 10.5 all use Bash as the default shell.
You can of course change that to any of the others that ship with it.
Earlier versions used Tcsh as default, but shipped with Bash and a
few others.

Konrad Meyer

9/24/2007 6:41:00 PM

0

Quoth Chad Perrin:
> On Mon, Sep 24, 2007 at 03:04:27PM +0900, Konrad Meyer wrote:
> > Quoth Todd Burch:
> > > Todd Burch wrote:
> > >
> > > > I've nevver know a blank character at the
> > > > end of a file name to be significant.
> > > >
> > > "never known" ... sorry.
> >
> > Yes, on *nix systems this is significant (probably windows too, I'm just
> > unfamiliar with it). You can also do "ruby myprog.rb\ " to escape the
space.
>
> If I'm not mistaken, MacOS X uses bash as its default shell. That would
> mean you don't actually need to escape the space if you use quotes:
>
> $ ruby "myprog.rb "
>
> The same is true of (t)csh:
>
> > ruby 'myprog.rb '
>
> In either shell, whether you use single or double quotes doesn't matter,
> and escaping the space (without quotes) also works.
>
> Whether or not the space is significant when first naming the file
> depends on how you name it. I believe that is true on MS Windows as well
> as systems such as MacOS X, various Linux distributions, SysV and BSD
> Unix systems, and so on -- though I don't have an MS Windows machine in
> front of me to test it. An extra space after a filename shouldn't
> produce a space character in the the filename itself when entered at a
> command line shell, but will probably do so with certain GUI-oriented
> means of naming files.
>
> --
> CCD CopyWrite Chad Perrin [ http://ccd.ap... ]
> McCloctnick the Lucid: "The first rule of magic is simple. Don't waste your
> time waving your hands and hopping when a rock or a club will do."

The quotes were for quoting the entire command, not the argument.
Escaping works without quotes. Tab-completion will should you the escaped
form (sans quotes).

Regards,
--
Konrad Meyer <konrad@tylerc.org> http://konrad.sobertil...

Konrad Meyer

9/24/2007 7:11:00 PM

0

Quoth Konrad Meyer:
> Quoth Chad Perrin:
> > On Mon, Sep 24, 2007 at 03:04:27PM +0900, Konrad Meyer wrote:
> > > Quoth Todd Burch:
> > > > Todd Burch wrote:
> > > >
> > > > > I've nevver know a blank character at the
> > > > > end of a file name to be significant.
> > > > >
> > > > "never known" ... sorry.
> > >
> > > Yes, on *nix systems this is significant (probably windows too, I'm just
> > > unfamiliar with it). You can also do "ruby myprog.rb\ " to escape the
> space.
> >
> > If I'm not mistaken, MacOS X uses bash as its default shell. That would
> > mean you don't actually need to escape the space if you use quotes:
> >
> > $ ruby "myprog.rb "
> >
> > The same is true of (t)csh:
> >
> > > ruby 'myprog.rb '
> >
> > In either shell, whether you use single or double quotes doesn't matter,
> > and escaping the space (without quotes) also works.
> >
> > Whether or not the space is significant when first naming the file
> > depends on how you name it. I believe that is true on MS Windows as well
> > as systems such as MacOS X, various Linux distributions, SysV and BSD
> > Unix systems, and so on -- though I don't have an MS Windows machine in
> > front of me to test it. An extra space after a filename shouldn't
> > produce a space character in the the filename itself when entered at a
> > command line shell, but will probably do so with certain GUI-oriented
> > means of naming files.
> >
> > --
> > CCD CopyWrite Chad Perrin [ http://ccd.ap... ]
> > McCloctnick the Lucid: "The first rule of magic is simple. Don't waste
your
> > time waving your hands and hopping when a rock or a club will do."
>
> The quotes were for quoting the entire command, not the argument.
> Escaping works without quotes. Tab-completion will should you the escaped
> form (sans quotes).
>
> Regards,
> --
> Konrad Meyer <konrad@tylerc.org> http://konrad.sobertil...

Er, my bad. Tab-completion should *also* give you the escaped form (sans
quotes). My English translator must be broken today.

--
Konrad Meyer <konrad@tylerc.org> http://konrad.sobertil...