1
2
I have an application that I'm porting and as part of the test suite, I run sha1sum
. I'd like to have test code that works on all my platforms and not vary across platforms. Mac OS X, is the first platform without a sha1sum
application. I did find a shasum
application though. So I created a symbolic link:
cd /usr/local/bin; ln -s /usr/bin/shasum sha1sum
However, the test now fails with a Perl error:
bash-3.2$ sha1sum -c files.sha1sum
perl version 5.16.2 can't run /usr/local/bin/sha1sum. Try the alternative(s):
(Error: no alternatives found)
Run "man perl" for more information about multiple version support in
Mac OS X.
bash-3.2$ shasum -c files.sha1sum
smallData.txt: OK
The contents of /usr/bin/shasum are:
#!/usr/bin/perl
=for comment
The contents of this script should normally never run! The perl wrapper
should pick the correct script in /usr/bin by appending the appropriate version.
You can try appending the appropriate perl version number. See perlmacosx.pod
for more information about multiple version support in Mac OS X.
=cut
use strict;
use Config ();
my @alt = grep {m,^$0\d+\.\d+(?:\.\d+)?$,} glob("$0*");
print STDERR <<"EOF-A";
perl version $Config::Config{version} can't run $0. Try the alternative(s):
EOF-A
if(scalar(@alt) > 0) {
for(@alt) {
my($ver) = /(\d+\.\d+(?:\.\d+)?)/;
print STDERR "$_ (uses perl $ver)\n";
}
} else {
print STDERR "(Error: no alternatives found)\n";
}
die <<'EOF-B';
Run "man perl" for more information about multiple version support in
Mac OS X.
EOF-B
How can I get a sha1sum
executable in my search path that will work like shasum
does?
This might be of use: https://raam.org/2008/howto-install-md5sum-sha1sum-on-mac-os-x/
– David – 2015-12-03T22:45:49.330