Mac下如何忽略环境变量?
希望有人能帮助我。我为 python 和其他一些库编写了一个安装 shell 脚本。所有软件包都安装在选定的文件夹中。例如“~/Desktop/inst”而不是“/usr/local”下。问题是,如果设置了一些环境变量,那么它们可能会搞乱安装。有可能以某种方式阻止这种情况发生吗?也许忽略设置的环境变量。或者还有其他技巧吗?
hope someone can help me. I wrote an installation shell script for python and some other libraries. All the packages are installed in a selected folder. For example "~/Desktop/inst" and not under "/usr/local". The problem, if there are some environment variables set, then they could mess up the installation. Is it somehow possible to prevent that? Maybe to ignore the set environment variables. Or is there maybe an other trick?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的...查找loginhook并通过使其成为您的mac的loginhook来运行您的脚本...这样当您的系统登录并且不存在变量时,您的应用程序应该运行良好,因为没有变量。希望有帮助。这是了解如何将应用程序设置为登录挂钩的链接[此处]。希望这有帮助
http://hints.macworld.com/article.php?story=2006081701162739
yeah...look up for loginhook and run your script by making it the loginhook for your mac...that way when ur system logs in and no variables exist, your application should run fine as there are no variables. hope it helps. here is a link for knowing how to set an app as loginhook [here]. hope this helps
http://hints.macworld.com/article.php?story=2006081701162739
您可以使用 printenv 来查看设置了哪些变量并取消设置它们(除了您想要/需要保留的变量,例如 PATH):
You could use
printenv
to see what variables are set and unset them (except for the ones you want/need to keep, like PATH):