如何在 Solaris 中更改全局变量?
我尝试使用以下命令更改 Solaris 中的全局变量 DSQUERY:
setenv DSQUERY "SYBSERVER"
但它没有保留。当我再次输入机器时,该值被设置为旧值。
我怎样才能坚持这个改变?
I've tried to change global variable DSQUERY in Solaris with this command:
setenv DSQUERY "SYBSERVER"
but it wasn't persisted. When I entered again in the machine the value was set to the older one.
How can I persist this change?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须将此行放入您的配置文件中。当您启动 shell 时会读取此文件,并允许您设置一些特定设置。
文件名取决于您使用的 shell 以及连接方式(例如,使用直接连接或使用 su)。
看来您使用 csh,因此您必须更改 $HOME/.cshrc 和/或 $HOME/.login 文件。
将 SetEnv 命令添加到 .cshrc 和 .login 文件即可完成这项工作。
You have to put this line in your profile file. This file is read when you start a shell, and allows you to set-up some specific settings.
The filename depends on the shell you use and how you connect (with a direct connexion or with a su for example).
It seems you use csh, so you will have to change $HOME/.cshrc and.or $HOME/.login files.
Add your SetEnv command to .cshrc and .login file will do the job.
您必须在用户配置文件中执行此操作,具体取决于所使用的 shell(.login、.cshrc、.bashrc 等),以便当您再次登录时,它会自动执行。对于某些 shell,/etc 下有这些文件的全局版本,以防您希望将其应用于所有用户。
平均值,
丹尼尔
You have to do it in the user profile files, depending on the shell being used (.login, .cshrc, .bashrc, etc) so that when you log in again, it's executed automatically. There are global versions of those files under /etc for some shells, in case you want that to be applied to all users.
Rgds,
Daniel