我需要在Linux/OSX终端下使用“clean”shell(例如bash),而无需任何用户配置,但每次启动时都会从某些文件(例如〜/ .bashrc)读取配置信息。每次我需要一个“干净”的shell时,我都可以修改这个文件,并在完成后恢复它,但是有没有更简单的方法来执行此操作,例如命令?如何在没有任何用户配置的情况下启动shell?
20
A
回答
10
2
使用--noprofile --norc:
--noprofile
Do not read either the system-wide startup file /etc/profile or any of the personal initializa‐
tion files ~/.bash_profile, ~/.bash_login, or ~/.profile. By default, bash reads these files
when it is invoked as a login shell (see INVOCATION below).
--norc Do not read and execute the system wide initialization file /etc/bash.bashrc and the personal
initialization file ~/.bashrc if the shell is interactive. This option is on by default if the
shell is invoked as sh.
(从手册页)。
31
运行bash --noprofile --norc
仍然继承父进程。基于similar question我发现我解释这个问题的方式env -i bash --norc --noprofile
是我想要的。
相关问题
- 1. 如何在没有用户交互的情况下在ASP.NET中启动任务
- 2. 如何在没有shell访问权限的情况下启动PHP脚本?
- 3. 如何在没有EULA的情况下启动ChromeDriver.exe?
- 4. 如何在没有任何图标的情况下使用NSAlert?
- 5. 如何在没有dll的情况下访问配置文件?
- 6. 如何在没有WSGI的情况下为Gunicorn配置ExecStart?
- 7. 如何在没有app.config的情况下配置角色?
- 8. 如何在没有执行任何操作的情况下启动活动启动的倒数计时器?
- 9. 如何在没有CronJob的情况下安排Unix Shell脚本
- 10. 如何在没有BIOS设置的情况下从USB启动Windows?
- 11. 如何通过windowManager.UpdateViewLayout在没有任何动画的情况下移动视图?
- 12. ROR如何在没有注册的情况下记住用户?
- 13. 如何在没有域名的情况下获取用户名
- 14. 如何在没有用户干预的情况下登录Facebook?
- 15. 如何在没有安装的情况下启动Python应用程序?
- 16. 如何在没有任何框架的情况下使用带有Maven的webjar
- 17. 如何在没有任何活动的情况下显示进度条?
- 18. 如何在没有任何动态库的情况下编译swift?
- 19. 如何在没有任何属性文件的情况下在Spring配置文件中使用占位符?
- 20. 可以在没有任何VCS的情况下使用weblate?
- 21. 如何在没有sudo的情况下使用Vagrant配置软件
- 22. 如何在没有配置文件的情况下使用Oracle Entity Framework
- 23. 如何在不重新启动的情况下刷新MySQL配置文件?
- 24. 用javascript在没有ActiveX的情况下启动word?
- 25. 如何在没有任何动作的情况下启动一个计时器?(java swing timer)
- 26. 在没有shell窗口的情况下运行shell命令
- 27. 在没有任何用户事件的情况下连续更改div的html
- 28. ASP.Net如何在没有用户第一次请求的情况下自动启动应用程序?
- 29. 如何让UIAlertView在没有用户交互的情况下自动隐藏?
- 30. 如何在没有客户机密的情况下构建GoogleCredential?
题外话;属于[su] – 2012-02-20 07:20:26
或Unix&Linux。 – 2012-02-20 23:00:38