简体   繁体   English

命令“哪个perl”仅在从bash退出后显示

[英]Command 'which perl' only displays after exit from bash

Ok, I'm back with another simple question... 好吧,我回来了另一个简单的问题...

Unix flavor: SunOS devsrv2 5.10 Generic_147148-26 i86pc i386 i86pc Unix风格:SunOS devsrv2 5.10 Generic_147148-26 i86pc i386 i86pc

In my work environment, I log into a tsch shell... and after I login, I type "bash" and it drops me into a bash shell (which I prefer). 在我的工作环境中,我登录到一个tsch shell中……登录后,我键入“ bash”,它将其放入bash shell中(我更喜欢)。

So instead of always having to type "bash", I created a .cshrc script that has one line in it: 因此,我不必总是键入“ bash”,而是创建了一个.cshrc脚本,其中包含一行:

#.cshrc
bash

and after logging out and logging back in, I go DIRECTLY into a bash shell... 注销并重新登录后,我直接进入bash外壳...

Here's the problem... Before, when I did the two step process of logging in and then typing "bash", I could type "which perl" and I would get the response "/usr/bin/perl"... 这是问题所在……之前,当我完成登录并输入“ bash”的两步过程时,我可以键入“哪个perl”,然后得到响应“ / usr / bin / perl” ...

Now I don't get anything back.... UNTIL I issue the command "exit" and then the "/usr/bin/per" text comes up... 现在我什么也没回来。...直到我发出命令“ exit”,然后出现“ / usr / bin / per”文本...

so, to summarize: 因此,总结一下:

  1. I login 我登录
  2. I type "bash" 我输入“ bash”
  3. I type "which perl" 我输入“哪个perl”
  4. I get back "/usr/bin/per" 我回来“ / usr / bin / per”

when I add the .cshrc file and login: 当我添加.cshrc文件并登录时:

  1. Drops me directly into bash 让我直接陷入重击
  2. I type "which perl" 我输入“哪个perl”
  3. I don't get anything but the command line back 除了命令行,我什么也没得到
  4. I type "exit" 我输入“退出”
  5. I get "/usr/bin/perl" 我得到“ / usr / bin / perl”

I have a feeling it has to do with the system setting STDOUT when I type bash vs when I manually do it in the cshrc file, but I'm not sure how to export it in the script... 我感觉当我在bsh中键入bash时与在cshrc文件中手动进行设置时,它与系统设置STDOUT有关,但是我不确定如何在脚本中将其导出...

Any help is much appreciated. 任何帮助深表感谢。

Thanks. 谢谢。

You don't want to manually change your shell... There are "behind the scenes" things that you may not be taken into consideration that need to be loaded before you enter the shell... 您不想手动更改外壳...在进入外壳之前,有一些“幕后”东西可能不需要考虑,因此需要加载它们...

The best way to do this is to have a root user run the command: 最好的方法是让root用户运行以下命令:

usermod -s /usr/bin/bash userfoo #user: userfoo usermod -s / usr / bin / bash userfoo #user:userfoo

This will get your environment set up properly, saving you lots of headache and time. 这将使您的环境得到正确设置,从而节省了很多麻烦和时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM