 |
 |
ksh is supplied in Tiger!
|
 |
|
 |
|
Dedicated MacNNer
Join Date: May 2004
Status:
Offline
|
|
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/
|
| |
|
|
|
 |
|
 |
|
Moderator 
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status:
Offline
|
|
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
|
|
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
|
|
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"
|
| |
|
|
|
 |
|
 |
|
Moderator 
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status:
Offline
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
...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
|
|
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
|
|
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
|
|
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! 
|
|
|
| |
|
|
|
 |
|
 |
|
Moderator 
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status:
Offline
|
|
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.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|