Sponsored in part by... Bare Bones Software Yojimbo 1.5 from Bare Bones Software: Your effortless, reliable
information organizer for Mac OS X. It will change your life,
without changing the way you work. Download the demo or buy it
today! <http://www.barebones.com/products/yojimbo/>

 [F] TidBITS  / TidBITS  / TidBITS Talk  /

Shell scripting Classic with bash?

[dano]dano (apparently) - 09:29am Apr 26, 2008 PST
via email

A colleague is getting a new MacBook Pro to replace her PowerBook G4.
She does a lot of work in SAS, but the last version of SAS to work on
Macs was v6, which only runs in Classic. Now with the new MBP she'll
run SAS on Windows, but we need to do a file rename in the old
version, i.e. in Classic, in preparation for a file format update in
the new version.

There are too many files buried too deeply in multiple folders to
easily do this by hand and actually, the old SAS can't handle the
really long pathnames. But we think we can work around the problem
with a shell script, if bash can interact with the Classic Finder.

The shell is a fundamental part of OSX, but can it interact with
Classic? Any suggestions?

Thanks,

DOD


Mark as Read
  OutlineAll MessagesOlder MessagesOldest MessagesNewest MessagesNewer Messages

schinder (apparently) - Apr 26, 2008 3:52 pm (#1 Total: 13)  

Reply to this message
via email  

Photo of Author
Posts: 112
Re: Shell scripting Classic with bash?



On Apr 26, 2008, at 12:29 PM, Dan O'Donnell wrote:

> A colleague is getting a new MacBook Pro to replace her PowerBook G4.
> She does a lot of work in SAS, but the last version of SAS to work on
> Macs was v6, which only runs in Classic. Now with the new MBP she'll
> run SAS on Windows, but we need to do a file rename in the old
> version, i.e. in Classic, in preparation for a file format update in
> the new version.
>
> There are too many files buried too deeply in multiple folders to
> easily do this by hand and actually, the old SAS can't handle the
> really long pathnames. But we think we can work around the problem
> with a shell script, if bash can interact with the Classic Finder.
>
> The shell is a fundamental part of OSX, but can it interact with
> Classic? Any suggestions?

Why do you need to interact with Classic at all? As I understand it,
you just want to rename some files. bash can do mv just fine.

Paul Schinder
schinderpobox.com



Lewis Butler (apparently) - Apr 27, 2008 3:54 am (#2 Total: 13)  

Reply to this message
via email  

Photo of Author
Posts: 928
Re: Shell scripting Classic with bash?

On 26-Apr-2008, at 10:29, Dan O'Donnell wrote:
> But we think we can work around the problem
> with a shell script, if bash can interact with the Classic Finder.

Bash cannot interact with the Classic finder. Why would it need to?

> The shell is a fundamental part of OSX, but can it interact with
> Classic? Any suggestions?

No. Classic and the shell cannot communicate at all.

But the files are there under OS X, so what is the issue?

cdevers (apparently) - Apr 28, 2008 3:12 am (#3 Total: 13)  

Reply to this message
via email  

Photo of Author
Posts: 108
Re: Shell scripting Classic with bash?

On Sat, 26 Apr 2008, Dan O'Donnell wrote:

> A colleague is getting a new MacBook Pro to replace her PowerBook G4.
> She does a lot of work in SAS, but the last version of SAS to work on
> Macs was v6, which only runs in Classic. Now with the new MBP she'll
> run SAS on Windows, but we need to do a file rename in the old
> version, i.e. in Classic, in preparation for a file format update in
> the new version.
>
> There are too many files buried too deeply in multiple folders to
> easily do this by hand and actually, the old SAS can't handle the
> really long pathnames. But we think we can work around the problem
> with a shell script, if bash can interact with the Classic Finder.
>
> The shell is a fundamental part of OSX, but can it interact with
> Classic? Any suggestions?
 
Well, maybe, but the primary problem with this line of thought is the
fact that there is no such thing as Classic on a Macbook Pro.

No way, no how.

If the Classic scripting is going to happen on the Powerbook, then fine,
there may be some way to do this the way you're asking for. But if she's
thinking of getting rid of the PBG4 and just using the MBP, the old
version of the software goes away with the Classic support.

There are other problems with the idea too. In particular, there's no
such thing as the "Classic Finder" for these purposes -- if running a
copy of OS9 through Classic on a PowerPC OSX machine, you won't be able
to invoke the OS9 version of Finder at all.

No way, no how.

Really, she may be better off doing the file rename on the old computer,
and/or using Parallels or VMWare to run Windows and the newer version of
the software on the MBP.

Classic just isn't a viable option on the new computer.


--
Chris Devers

kevinv (apparently) - Apr 28, 2008 3:12 am (#4 Total: 13)  

Reply to this message
via email  

Photo of Author
Posts: 1317
Re: Shell scripting Classic with bash?

--On April 26, 2008 9:29:09 AM -0700 Dan O'Donnell <danowell.com> wrote:

> But we think we can work around the problem
> with a shell script, if bash can interact with the Classic Finder.
>
> The shell is a fundamental part of OSX, but can it interact with
> Classic? Any suggestions?

Classic is not like Windows virtual machines with VMWare or Parallels, in
those products everything is kept in a container that is not accessible
from Mac OS X.

Classic only virtualizes the operating system and running Classic
applications. Files themselves are kept on your regular drive, so they can
be manipulated from the OS X shell without problems.

Kevin


David Weintraub (apparently) - Apr 28, 2008 3:12 am (#5 Total: 13)  

Reply to this message
via email  

Photo of Author
Posts: 197
Re: Shell scripting Classic with bash?

Bash can't interact with the Classic Finder, but it can interact with
the files under the Classic folder.

The Unix "mv" command will rename the file or move it to a new
directory. Be careful about copying via "cp" though. Classic files
have data and resource forks, and the Unix underlying system doesn't
handle that very well. The "mv" will work as long as it is on the same
physical disk.
--
David Weintraub
qazwartgmail.com

John C. Welch (apparently) - Apr 29, 2008 5:44 am (#6 Total: 13)  

Reply to this message
via email  

Photo of Author
Posts: 754
Re: Shell scripting Classic with bash?

On 4/28/08 5:12 AM, "David Weintraub" <qazwartgmail.com> wrote:

> The Unix "mv" command will rename the file or move it to a new
> directory. Be careful about copying via "cp" though. Classic files
> have data and resource forks, and the Unix underlying system doesn't
> handle that very well. The "mv" will work as long as it is on the same
> physical disk.

With Mac OS X 10.4 and later, cp/mv/etc are fork-aware.

--
John C. Welch

Mike Cohen (apparently) - Apr 29, 2008 5:44 am (#7 Total: 13)  

Reply to this message
via email  

Photo of Author
Posts: 133
Re: Shell scripting Classic with bash?

The 'ditto' or 'rsync' commands will preserve resource forks.

dano (apparently) - Apr 29, 2008 5:44 am (#8 Total: 13)  

Reply to this message
via email  

Photo of Author
Posts: 79
Re: Shell scripting Classic with bash?

At 3:12 AM -0700 4/28/08, Kevin van Haaren wrote:
>--On April 26, 2008 9:29:09 AM -0700 Dan O'Donnell <danowell.com> wrote:
>
>>But we think we can work around the problem
>>with a shell script, if bash can interact with the Classic Finder.
>>
>>The shell is a fundamental part of OSX, but can it interact with
>>Classic? Any suggestions?
>
>Classic is not like Windows virtual machines with VMWare or Parallels, in
>those products everything is kept in a container that is not accessible
>from Mac OS X.
>
>Classic only virtualizes the operating system and running Classic
>applications. Files themselves are kept on your regular drive, so they can
>be manipulated from the OS X shell without problems.

At 3:12 AM -0700 4/28/08, David Weintraub wrote:
>Bash can't interact with the Classic Finder, but it can interact with
>the files under the Classic folder.
>
>The Unix "mv" command will rename the file or move it to a new
>directory. Be careful about copying via "cp" though. Classic files
>have data and resource forks, and the Unix underlying system doesn't
>handle that very well. The "mv" will work as long as it is on the same
>physical disk.

Ah, those perfectly redefine what I was trying to figure out and answer.
Thanks very much!

Dan O'Donnell

cdevers (apparently) - Apr 29, 2008 5:44 am (#9 Total: 13)  

Reply to this message
via email  

Photo of Author
Posts: 108
Re: Shell scripting Classic with bash?

On Apr 28, 2008, at 10:53 AM, Dan O'Donnell wrote:

> We plan to do the file conversion on the old PPC machine, and since
> SAS only runs in Classic and we have to call SAS from bash, it seems
> that bash has to interact with the Finder in Classic - or whatever
> mechanism is there. We will script it with bash. Hence bash has to
> have some interaction with Classic. And that's my question - does
> bash "see" Classic and can it act on files and applications in
> Classic.

How is Bash going to interact with SAS if SAS is locked inside
Classic? Invoking osascript or something? If that's the case, this
sounds more like an Applescript question more than a Bash question.
Otherwise, it would be useful to clarify just how you're getting those
two to interoperate.

It also would help to have a clearer sense of what these file
conversions / renames are. If you're just renaming files (which is
part of what was mentioned earlier), then it seems like Bash can do
everything and there's no need for SAS or Classic at all. If you're
doing file format conversions, and then depositing the files in the
filesystem somwehere, then sure, Bash can pick those up and do
whatever you want with them -- to Bash's point of view, Classic (or
the Finder) doesn't even have to come into the picture to do simple
filesystem operations.

To repeat the other thing from the last mail, there is no concept of
interacting with the "Classic Finder" this way, as you'll just get an
error message if you try to launch the old Finder at all, so there's
no way to script it in any language, short of rebooting back to simple
OS9, in which case you won't have Bash available to begin with. That
line of thought is a dead end.

Bash can see & interact with anything in the filesystem. If your SAS
software can create, manipulate, and save files in the filesystem,
then Bash can work on those files. If you want to work at a higher
level -- having Bash drive the interaction in SAS, for example -- then
Bash probably can't do that directly, but Applescript might be able
to, and Bash can call Applescript using the `osascript` command line
tool, so that may work.


--
Chris Devers




barefootguru (apparently) - Apr 29, 2008 5:44 am (#10 Total: 13)  

Reply to this message
via email  

Photo of Author
Posts: 110
Re: Shell scripting Classic with bash?

On 2008-04-28, at 22:12, David Weintraub wrote:

> Be careful about copying via "cp" though. Classic files
> have data and resource forks, and the Unix underlying system doesn't
> handle that very well.

That hasn't been true since Tiger, when Apple upgraded cp, mv, and
friends to be resource-fork aware:

> Use command-line commands safely on HFS+ files. Utilities such as
> cp, mv, tar, rsync now use the same standard APIs as Spotlight and
> access control lists to handle resource forks properly.

<http://www.apple.com/sg/macosx/features/unix/>

In fact, if you do a 'man' for 'cp' you'll see:

> -X Do not copy Extended Attributes (EAs) or resource forks.

Cheers

David Weintraub (apparently) - Apr 30, 2008 4:18 am (#11 Total: 13)  

Reply to this message
via email  

Photo of Author
Posts: 197
Re: Shell scripting Classic with bash?

On Tue, Apr 29, 2008 at 8:44 AM, Tom Robinson
<barefootgurutomrobinson.co.nz> wrote:
> On 2008-04-28, at 22:12, David Weintraub wrote:
>
>
> > Be careful about copying via "cp" though. Classic files
> > have data and resource forks, and the Unix underlying system doesn't
> > handle that very well.
> >
>
> That hasn't been true since Tiger, when Apple upgraded cp, mv, and
> friends to be resource-fork aware:

That's nice to know. I haven't used Classic in years now, and I've
removed all my Classic programs and old data. That cleared up about 50
megabytes of disk space.

Which brings up an interesting question: Do Mac OS X programs use
resource/data forks? I figured that was done away with Mac OS X.

--
David Weintraub
qazwartgmail.com

Nigel Stanger (apparently) - May 1, 2008 8:12 am (#12 Total: 13)  

Reply to this message
via email - Dunedin, New Zealand  

Photo of Author
Posts: 412
Re: Shell scripting Classic with bash?

On 30/04/2008 11:18 PM, "David Weintraub" <qazwartgmail.com> spake thus:

> Which brings up an interesting question: Do Mac OS X programs use
> resource/data forks? I figured that was done away with Mac OS X.

Well, resource/data forks were always effectively "files within files", and
that's exactly what you get these days with bundles under Mac OS X. When you
right-click on a .app and "View contents", that's effectively the successor
to resource forks. I believe there are still such things as resource _files_
(with a .rsrc extension?).

--
Nigel Stanger, Dunedin, NEW ZEALAND.
http://xri.net/=nigel.stanger


j-beda (apparently) - May 1, 2008 8:15 am (#13 Total: 13)  

Reply to this message
via email  

Photo of Author
Posts: 150
Re: Shell scripting Classic with bash?

At 4:18 AM -0700 4/30/08, David Weintraub wrote:
>Which brings up an interesting question: Do Mac OS X programs use
>resource/data forks? I figured that was done away with Mac OS X.

        Some may, though most make use of bundles (special folder
structures) to hide complexity of this nature from us simple users.


--
* Johann Beda - contact link: <http://xri.net/=j-beda> *
* Johann's MostlyMac Computer Consulting - <http://mmcc.beda.ca/> *



  OutlineAll MessagesOlder MessagesOldest MessagesNewest MessagesNewer Messages


 [F] TidBITS  / TidBITS  / TidBITS Talk  / Shell scripting Classic with bash?




Add a message

To add a message to this discussion, you must be a registered user. Enter your email address below. If you have an account associated with the email address you enter, you will be prompted for your password. If not, you'll be able to create a new account with no fuss.

Enter your email address:

Submit