From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041111 Firefox/1.0 Description of problem: If I try to write a shell script with "tcsh -e", it just doesn't work. The reason is because the file /etc/profile.d/colorls.csh contains the line: test -f ~/.dircolors -- this sets the return code to be non-zero unless the file .dircolors exists, and causes the shell to abort. The workaround is: erase the file /etc/profile.d/colorls.csh The fix is to fix up this shell script so it doesn't rely on testing the return code of the test command. Version-Release number of selected component (if applicable): coreutils-5.2.1-31 How reproducible: Always Steps to Reproduce: 1. Create a shell script with the following contents: #!/bin/tcsh -e echo "Hi" 2. Try to run it. Actual Results: It doesn't print "Hi". Expected Results: Print "Hi". To show what is happening in detail, use "#!/bin/tcsh -eX" Additional info:
The 'test' commands can be avoided, but AFAICS there is no way to avoid the egrep, and (tcsh -e) will exit even if the egrep is executed while evaluating a controlling expression of the 'if' command.
So what's the answer?
Created attachment 107460 [details] Don't run commands that could exit with non-zero exit code To think again :) The attached patch should fix it. It assumes GNU sed, which is probably not a problem. Sorry for reassigning, I have confused the file with lang.csh.
Thanks for the patch! I've built this as coreutils-5.2.1-33.