OSX には、xpath というPerlで書かれてるコマンドがついてくる。
xpath コマンド。
takuya@rena:~/Desktop$ echo "<a><b><c>cccc</c></b></a>" | xpath "//c/text()" Found 1 nodes: -- NODE -- cccc
このように簡単にXpathを使って試すことが出来る。便利!
xpath コマンドは次の場所に
takuya@rena:~/Desktop$ which xpath /usr/bin/xpath
実体は perl
takuya@rena:~/Desktop$ head /usr/bin/xpath -n 20
#!/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) {
うーん。便利だけど出力が気に入らないから、作ったほうが速いような。