2

I am currently in bash but I want to change my shell to tcsh. I used ypchsh, entered my password when prompted and then changed the login shell to /bin/tcsh. And it seemed like it worked because I get a message that says "The login shell has been changed on [domain]". Then I logged out and logged back in. I did echo $0 to check my current shell but it says I'm still in /bin/bash. However, when I do echo $SHELL I get /bin/tcsh. And when I do ps, it shows that bash is running instead of tcsh.

Other trouble shooting steps taken: Tried doing the same steps to switch to different shells like sh and ksh which works. However, changing to csh gives me the same result as trying to change to tcsh. Checked /etc/shells and tcsh is listed. I also tried exec tcsh but the system still running bash.

I am trying to do this on a school account so maybe there is a permission issue. Although one of my classmate was able to get his account to change shell. If not permission is there like file that I need to config?

[user@machine ~]> echo $0
/bin/bash
[user@machine ~]> echo $SHELL
/bin/tcsh
[user@machine ~]> ypchsh
Changing NIS account information for user on machine
Please enter password:

Changing login shell for user on machine
To accept the default, simply press return. To use the
system's default shell, type the word "none".
Login shell [/bin/tcsh]: /bin/tcsh

The login shell has been changed on machine

[user@machine ~]> logout

[user@machine ~]> echo $0
/bin/bash
[user@machine ~]> echo $SHELL
/bin/tcsh
[user@machine ~]> FOO=BAR
[user@machine ~]> ps
  PID TTY          TIME CMD
14549 pts/21   00:00:00 bash
14780 pts/21   00:00:00 ps
[user@machine ~]> exec /bin/tcsh
[user@machine ~]> echo $0
/bin/bash
[user@machine ~]> echo $SHELL
/bin/tcsh
[user@machine ~]> FOO=BAR
[user@machine ~]>

[user@machine ~]> uname -a
Linux machine 2.6.32-696.3.2.el6.i686 #1 SMP Tue Jun 20 00:48:23 UTC 2017 i686 i686 i386 GNU/Linux
[user@machine ~]> /bin/ls -ld
drwx--s--x 49 user group 4096 Sep  1 13:08 .
[user@machine ~]> /bin/*sh
/bin/csh: /bin/csh: cannot execute binary file
[user@machine ~]> /usr/bin/*sh
Usage: amuFormat.sh <Card Type> <drive>
<Card Type> has to be defined in amuFormat.sh itself
<drive> has to be defined in mtools.conf
  • You do all these secondary steps to see what shell you’re running — what does the primary evidence say? What happens if you type FOO=BAR? What shell are you really running? And seriously? You tried exec tcsh and you’re still in bash? I feel like you’re not telling us the whole story. – Scott Sep 2 '17 at 2:56
  • @Scott I'm not very familiar with the Linux systems, can you explain how I can find the "primary evidence" and what you mean by typing in FOO=BAR? I also posted a history of commands I made. – Alice Sep 2 '17 at 4:42
  • (0) Thanks for providing the update, but it would be clearer if you would delete the > characters and insert $   before the shell commands.  It’s best if you copy from your terminal and paste into Super User. (Of course it’s OK to redact sensitive information like your username and machine name.) But if your shell prompt changes, show that. (1) You say you’re not very familiar with the Linux systems. I have to wonder how much you understand about the *nix shells, and why you want to change yours. (2) When I say type FOO=BAR, I mean type FOO=BAR (followed by Enter) at the shell prompt. – Scott Sep 2 '17 at 5:17
  • I updated and pasted what I've done in terminal. Tried FOO=BAR but it doesn't seem like it did anything. I don't know anything about nix shells and I need to be in tcsh because exercises in class are done in tcsh and it would be easier to follow if my shell is the same. – Alice Sep 2 '17 at 18:57
  • Ah, but you don't need to make it your primary shell just for that, do you? Any shell can be just launched from any other shell like a regular program. – grawity Sep 2 '17 at 19:15
0

The reason why my shell keeps going back to bash and even preventing me from using exec to get into tcsh was because in the .cshrc file there was a line that says exec /bin/bash -l in there. To fix this I removed that line and from that point on I can switch shells.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.