/etc/profile.d scripts

m.roth2006 at rcn.com m.roth2006 at rcn.com
Fri Apr 24 18:25:28 UTC 2009


>Date: Fri, 24 Apr 2009 11:17:18 -0700 (PDT)
>From: Ray Abbitt <rabbitt+rh at abbitt.org>  
>On Fri, 24 Apr 2009, Dave Martini wrote:
>
>> I have user logging into a RHEL4 box that has a default shell of C Shell.
>>
>> I have a script in /etc/profile.d that is a Bash shell script with a .sh 
>> extension.
>>
>> Is there a way to have the users shell switched to bash shell when they log 
<snip>
>Specify the shell to be used in the script. Make the first line of 
>your script:
>
>#!/bin/bash
>
The shell should ALWAYS be the first line. I, personally, would not accept one that didn't have that. Of course, I can't think of one I've seen that didn't.

>There may already be a line specifying another shell. If so, delete 
>it. Make sure to substitute the proper path if bash is not in /bin.
>Also note that the .sh extension is not really needed.

That first is not a good idea. What works in one may not work in another. For example, if there's an old shell script in Bourne, that will gag on 
export HOTSHOT=/home/myself
or 
alias h=history

And the extension certainly isn't necessary; however, I normally do it as good practice, so that you know what it is without doing a file on it.

     mark




More information about the redhat-list mailing list