PDA

View Full Version : Where can I find realpath



thewoland
2nd January 2007, 09:44 AM
I need 'realpath' in order to make a script to work.
I couldn't find any package that would contain it.
In some ALT Linux versions it resides in 'coreutils' package, however in FC there is no such binary.

Where can I find it?

webstertrivium
7th February 2007, 11:34 PM
Bump! I'm looking for an answer to this as well. I've got Fedora Core 5 installed on a server and was looking for the realpath binary usually found in /usr/bin/, but have been unable to find any information regarding it.

Any help is greatly appreciated!!

mnisay
8th February 2007, 12:08 AM
can you give more info of realpath pls? it does not exist by default installation in FCs boxes that I have.

have you tried

#yum search realpath

webstertrivium
8th February 2007, 12:21 AM
realpath resolves symlinks back to their real paths. I ended up just compiling this as the binary wrapper and placing it in /usr/bin:


#include <stdio.h>
#include <limits.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
int i;

for (i = 1; i < argc; i++) {
char rp[PATH_MAX];

if (!realpath(argv[i], rp)) {
perror(argv[i]);
return 1;
} else {
printf("%s\n", rp);
}
}

return 0;
}


Hopefully that helps somebody, because trying to find it was a major pain.