Description of Problem: If tcsh is invoked with "-" as argv[0][0] and with the -c option, the .login file is sourced before the command specified by -c is run. This happens, e.g., in /etc/X11/xdm/Xsession when it does exec -l $SHELL -c "gnome-session". In this case, it is possible to look at, and possibly change, $command (the command to be run by the shell). However, if .login (or, presumably, any file that is run in a login shell) references $command, the command is not run. For example: echo $command > foobar in the .login file will make the command not run. This is a bug, since the man page says that a command specified with -c will run, and does not mention this behavior as making it not run. Note that the -l portion of the man page says that -l is only effective if it is the only argument, but this is not said about the method mentioned above for getting a login shell. Why look at $command in .login? Why not just let it run when .login ends? If the .login file execs something, say ssh-agent inside a suitably protecting conditional, it had better exec the command the shell would run if the shell was invoked with -c. Otherwise, it must be invoked to run a login shell. This entails looking at $command. If the look is negative and the exec doesn't happen, the rest of .login runs. $command will nonetheless not run after .login ends. Version-Release number of selected component (if applicable): tcsh-6.10-6 How Reproducible: 100% Steps to Reproduce: 1. set up a bash shell script that does exec -l /bin/tcsh -c "date" 2. modify .login to look at $command 3. run the bash script Actual Results: the date is not printed Expected Results: the date is printed Additional Information: none --jh--
With tcsh-6.13-1 or 6.12-8: $ cat ~/.login echo $command > foobar echo FOO $ (exec -l /bin/tcsh -c date) FOO St srp 18 18:01:33 CEST 2004 $ cat foobar date