
현재 bash에 있지만 쉘을 tcsh로 변경하고 싶습니다. 저는 ypchsh를 사용했고 메시지가 표시되면 비밀번호를 입력한 다음 로그인 쉘을 /bin/tcsh로 변경했습니다. 그리고 "[도메인]에서 로그인 쉘이 변경되었습니다"라는 메시지가 표시되기 때문에 작동하는 것 같았습니다. 그런 다음 로그아웃했다가 다시 로그인했습니다. 현재 쉘을 확인하기 위해 echo $0 을 했지만 여전히 /bin/bash에 있다고 나옵니다. 그러나 echo $SHELL을 수행하면 /bin/tcsh가 표시됩니다. 그리고 ps를 실행하면 tcsh 대신 bash가 실행되고 있음이 표시됩니다.
수행된 기타 문제 해결 단계: 작동하는 sh 및 ksh와 같은 다른 쉘로 전환하기 위해 동일한 단계를 수행해 보았습니다. 그러나 csh로 변경하면 tcsh로 변경하려고 시도한 것과 동일한 결과가 나타납니다. /etc/shells를 확인하면 tcsh가 나열됩니다. exec tcsh도 시도했지만 시스템은 여전히 bash를 실행하고 있습니다.
학교 계정으로 이 작업을 수행하려고 하는데 권한 문제가 있을 수 있습니다. 내 반 친구 중 한 명이 자신의 계정을 통해 쉘을 변경할 수 있었지만. 권한이 없으면 구성해야 하는 파일과 같은 것이 있습니까?
[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
답변1
내 쉘이 계속 bash로 돌아가고 심지어 exec를 사용하여 tcsh에 들어가지 못하게 하는 이유는 .cshrc 파일에 다음과 같은 줄이 있었기 때문입니다 exec /bin/bash -l
. 이 문제를 해결하기 위해 해당 줄을 제거하고 그 시점부터 쉘을 전환할 수 있습니다.