Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > ksh is supplied in Tiger!

ksh is supplied in Tiger!
Thread Tools
Dedicated MacNNer
Join Date: May 2004
Status: Offline
Reply With Quote
Apr 12, 2005, 08:04 AM
 
Now I can run all my old scripts from Solaris! Woo-hoo!
╭1.5GHz G4 15" PB, 2.0GB RAM, 128MB VRAM, 100GB 7200rpm HD, AEBS, BT kbd
╰2.0GHz T2500 20" iMac, 1.5GB RAM, 128MB VRAM, 250GB 7200rpm HD

http://www.DogLikeNature.com/
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Apr 12, 2005, 03:37 PM
 
You most likely can in previous versions as well, by using zsh in ksh compability mode. Simply start it as ksh, ie make a symlink ksh -> zsh and start it that way.
     
Dedicated MacNNer
Join Date: May 2004
Status: Offline
Reply With Quote
Apr 13, 2005, 09:40 AM
 
Originally posted by P:
You most likely can in previous versions as well, by using zsh in ksh compability mode. Simply start it as ksh, ie make a symlink ksh -> zsh and start it that way.
Thanks, I never knew that!
╭1.5GHz G4 15" PB, 2.0GB RAM, 128MB VRAM, 100GB 7200rpm HD, AEBS, BT kbd
╰2.0GHz T2500 20" iMac, 1.5GB RAM, 128MB VRAM, 250GB 7200rpm HD

http://www.DogLikeNature.com/
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Apr 13, 2005, 08:51 PM
 
Originally posted by P:
You most likely can in previous versions as well, by using zsh in ksh compability mode. Simply start it as ksh, ie make a symlink ksh -> zsh and start it that way.
Ah, much like sh, which is really a bit-for-bit copy of bash:
Code:
[theman@thefro: ~]$ ls -l `which sh` -r-xr-xr-x 1 root wheel 603488 10 Aug 2004 /bin/sh [theman@thefro: ~]$ ls -l `which bash` -rwxr-xr-x 1 root wheel 603488 10 Aug 2004 /bin/bash
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Apr 14, 2005, 01:35 PM
 
It is a copy - always thought it was a hardlink, that would have made more sense, but the inode numbers are different. The tricky part about ksh is that the ksh -> zsh link is not installed in versions pre-Tiger. I sort of suspect that all Apple did was install this link by default, or just make another copy.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Apr 14, 2005, 01:57 PM
 
Hard links are squiffy on HFS, though. Anyway, it's more accurate to say that sh is a copy of bash, since it's really just bash running in a compatibility mode.
     
Senior User
Join Date: May 2001
Status: Offline
Reply With Quote
Apr 14, 2005, 04:30 PM
 
Originally Posted by [APi]TheMan
Ah, much like sh, which is really a bit-for-bit copy of bash:
Code:
[theman@thefro: ~]$ ls -l `which sh` -r-xr-xr-x 1 root wheel 603488 10 Aug 2004 /bin/sh [theman@thefro: ~]$ ls -l `which bash` -rwxr-xr-x 1 root wheel 603488 10 Aug 2004 /bin/bash
md5 works better at demonstrating that than ls.
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Apr 15, 2005, 12:00 AM
 
Originally Posted by Moose
md5 works better at demonstrating that than ls.
Ah, that it does:
Code:
[theman@thefro: ~]$ md5 `which sh` MD5 (/bin/sh) = 324c44b00a33984ffe52a45d5c3213fb [aorth@nacho: ~]$ md5 `which bash` MD5 (/bin/bash) = 324c44b00a33984ffe52a45d5c3213fb
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Apr 16, 2005, 03:19 AM
 
Originally Posted by Moose
md5 works better at demonstrating that than ls.
And diff works even better!

Code:
> diff -s /bin/bash /bin/sh Files /bin/bash and /bin/sh are identical
     
Dedicated MacNNer
Join Date: May 2004
Status: Offline
Reply With Quote
Apr 16, 2005, 05:21 PM
 
...and cmp works even better:
Code:
cmp /bin/sh /bin/bash && echo "Identical"
╭1.5GHz G4 15" PB, 2.0GB RAM, 128MB VRAM, 100GB 7200rpm HD, AEBS, BT kbd
╰2.0GHz T2500 20" iMac, 1.5GB RAM, 128MB VRAM, 250GB 7200rpm HD

http://www.DogLikeNature.com/
     
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Apr 16, 2005, 06:03 PM
 
How is that better? When comparing binary files of this size, diff is faster than cmp, and has the advantage of better output options.
     
Dedicated MacNNer
Join Date: May 2004
Status: Offline
Reply With Quote
Apr 17, 2005, 10:56 PM
 
Originally Posted by Rainy Day
How is that better? When comparing binary files of this size, diff is faster than cmp, and has the advantage of better output options.
In other UNIXes diff cannot handle binary files (it's line based), so typically old-schoolers will use cmp for binaries, and diff for text. Also course cmp exits at the first difference, whereas diff will continue to the end, showing all differences. That can make cmp much faster if we're not really interested in the differences themselves.

In this case, as we're just interested in whether or not the binaries are identical, cmp makes sense.
(Last edited by Dog Like Nature; Apr 17, 2005 at 11:06 PM. )
╭1.5GHz G4 15" PB, 2.0GB RAM, 128MB VRAM, 100GB 7200rpm HD, AEBS, BT kbd
╰2.0GHz T2500 20" iMac, 1.5GB RAM, 128MB VRAM, 250GB 7200rpm HD

http://www.DogLikeNature.com/
     
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Apr 26, 2005, 12:18 AM
 
Originally Posted by Dog Like Nature
In other UNIXes diff cannot handle binary files (it's line based)
GNU diff handles binaries quite efficiently. MacOS X and OpenBSD both use it (as do, i suspect, most modern BSD's).

Also course cmp exits at the first difference, whereas diff will continue to the end, showing all differences.
When comparing binary files, diff also stops at the first difference (and with the appropriate switches, will do so for text files too).

That can make cmp much faster if we're not really interested in the differences themselves.
As i said previously, diff outperforms cmp in binaries of this size (and perhaps of any size). It's very efficient.

In this case, as we're just interested in whether or not the binaries are identical, cmp makes sense.
Not really. diff is faster than cmp, has the advantage of better output options, and the command syntax for this operation is simpler. GNU diff ain't your Dad's diff anymore!
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Apr 26, 2005, 01:17 PM
 
Not that it isn't entertaining or anything, but can either of you show any sort of evidence which method is faster? They're both part of the GNU diffutils, so it's likely that they share a certain amount of code and are very likely to be just as fast in many cases.

And I'm not just being obnoxious, I'd actually really like to know if there is any difference either way or the other.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:17 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2