决定像罗胖一样,坚持转发他的60“语音, 看我能不能一样坚持下来!

centos realpath命令没有被安装的话

技术笔记 eagle 22151℃ 0评论

 

用下面的代码,编译生成一个, 后放到bin中。运行如下命令即可以

cc realpath.c -o realpath.
sudo chown root:root realpath
sudo chmod 755 realpath
sudo cp realpath /bin

If you put it into other directories, you may need to follow up with chmod +s realpath
CODE FOLLOWS.

/********************** temporary version of realpath ***********************
* use until a coreutils version is produced.  This version does the minimum *
* necessary to resolve relative to absolute paths. One argument, the input string to be resolved.
*/ 
#include <stdio.h>
#include <stdlib.h>
#include  <limits.h>

int main(int argc,char **argv)
{
  char rlpath[PATH_MAX];
  char *cp;
  if (argc==2)
  {
     cp= realpath(argv[1],rlpath);
     fprintf(stdout,"%s\n",cp);
     exit(0);
  }
    exit(1);
}

转载请注明:艾依小站 » centos realpath命令没有被安装的话

喜欢 (0)or分享 (0)
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址