[Pharo-project] Using Pharo from the command-line

David T. Lewis lewis at mail.msen.com
Mon Sep 7 12:40:05 EDT 2009


See class ShellSyntax in package CommandShell (be sure to load the
unit tests also).

The class comment for ShellSyntax is:

  My instances implement parsing of strings in a manner similar to a simple
  Unix command shell. I provide path name expansion in the context of an
  external file system, and support the syntax required for IO redirection.
  All file name globbing and PATH searching are implemented in Smalltalk
  rather than in C library functions or an external command shell.
  
  Most of my syntax is applicable for any operating system. Where needed,
  platform specific methods are in my "platform dependent" category.
  Currently, Unix and Windows are supported, and other platforms have not
  been tested. The primary difference between Unix and Windows support
  is that device names (such as 'C:') are used in Windows path strings.
  Separate current working directory strings are maintained for all
  Windows device names. For Unix, a single current working directory path
  is used. On Windows, this permits the CommandShell 'cd' command to support
  changing directories to another device without losing track of the current
  working directory for the previous device.
  
  Command pipeline syntax is not supported here. See CommandShell for the
  implementation of command pipelines.

Dave


On Mon, Sep 07, 2009 at 08:54:18AM -0700, Igor Stasenko wrote:
> The problem with command-line arguments as a file names, like:
> 
> cat myfile.foo
> 
> is that the location of myfile.foo is determined by using a search
> path , usually provided in environment PATH var of a shell.
> 
> I worked in a different unix shells, and some of them, do not
> adding/using the ./ into the search path by default, which means
> that
> cat myfile.foo
> will end up with 'file not found' message,
> while
> cat ./myfile.foo
> will work fine.
> 
> i think that squeak should follow the shell semantics and do not try
> to automatically expand the pure file name, like
> foo.bar into something like: ./foo.bar, or ~/foo.bar
> 
> 2009/9/2 John M McIntosh <johnmci at smalltalkconsulting.com>:
> > I think ??here you are trying to get to test.sq
> >
> > I only adjust the incoming image name in the VM looking for ~ for
> > example, and resolving usage of ./ and ../
> >
> > The additional command line items are then passed to the image
> > unchanged, so it sees only 'test.sq' ??as the path name.
> > You would have to check the smalltalk code at the point where it gets
> > the command line parm and decide if it's 'test.sq' should that really
> > be './test.sq'
> > You might also try putting './test.sq' on the command line and see if
> > that works.
> >
> >
> > On 2-Sep-09, at 9:23 AM, St??phane Ducasse wrote:
> >
> >>>>
> >>> The full path requirement should be considered a bug from my
> >>> perspective.
> >>
> >> mine too and I thought that john fixed that.
> >> So did you try without?
> >
> > --
> > =
> > =
> > =
> > ========================================================================
> > John M. McIntosh <johnmci at smalltalkconsulting.com> ?? Twitter:
> > squeaker68882
> > Corporate Smalltalk Consulting Ltd. ??http://www.smalltalkconsulting.com
> > =
> > =
> > =
> > ========================================================================
> >
> >
> >
> >
> >
> > _______________________________________________
> > Pharo-project mailing list
> > Pharo-project at lists.gforge.inria.fr
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> 
> 
> 
> -- 
> Best regards,
> Igor Stasenko AKA sig.
> 
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project




More information about the Pharo-dev mailing list