$ HOME和“〜”(代字号)之间的区别? [英] Difference between $HOME and '~' (tilde)?

查看:326
本文介绍了$ HOME和“〜”(代字号)之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前一直以为 $ HOME 都是一模一样的,因此可以
可以互换使用。今天,当我试图安装的 pylibmc 的,巨蟒
结合memcached的,我的共享服务器上使用的给了我的错误,但不
$ HOME 。我想弄明白为什么。

I had always thought that $HOME and ~ were exactly the same and thus could be used interchangeably. Today, when I tried to install pylibmc, a python binding to memcached, on my shared server the use of ~ gave me error but not $HOME. I would like to reason out why.

libmemcached 的是 pylibmc 的要求。我的 libmemcached 的安装
我的主目录下的,因为我已经在服务器上没有根。其结果是,对
安装的 pylibmc 的,我需要确保安装脚本知道到哪里
找到的 libmemcached

libmemcached is a requirement for pylibmc. I have libmemcached installed under my home directory because I have no root on the server. As a result, to install pylibmc, I need to make sure the installation script knows where to find libmemcached.

在执行蟒蛇的setup.py安装--with-libmemcached =〜,安装
脚本运行

When executing python setup.py install --with-libmemcached=~, the installation script runs


gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall \
  -Wstrict-prototypes -fPIC -DUSE_ZLIB -I~/include \
  -I/usr/local/include/python2.7 -c _pylibmcmodule.c \
  -o build/temp.linux-i686-2.7/_pylibmcmodule.o -fno-strict-aliasing

,它给出了 libmemcached 的无法找到。

如果我更改为 - 与-libmemcached = $ HOME ,运行脚本

If I change to --with-libmemcached=$HOME, the script runs


gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall \
  -Wstrict-prototypes -fPIC -DUSE_ZLIB -I/home/waterbotte/include \
  -I/usr/local/include/python2.7 -c _pylibmcmodule.c \
  -o build/temp.linux-i686-2.7/_pylibmcmodule.o -fno-strict-aliasing

没有任何问题。它看起来像问题是,波浪没有得到解决。但是,为什么?

without any problem. It looks like the problem is that tilde doesn't get resolved. But why?

推荐答案

外壳替换与用户的主目录(更新:或也许一些其他用户的主目录下,如果后跟超过 / ),但唯一的其他东西如果它是一个单词的第一个字符。

The shell replaces ~ with the user's home directory (update: or perhaps by the home directory of some other user, if ~ is followed by something other than a /), but only if it's the first character of a word.

- 与-libmemcached =〜不是在开始的时候,所以外壳离开单干。

--with-libmemcached=~ has ~ not in the beginning, so the shell leaves it alone.

这篇关于$ HOME和“〜”(代字号)之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆