On CentOS 8 in profile.d do I need to add my script related to environment variables to both an .sh and .csh file?
It depends on the shell that is being used.
.sh
is for Bash
. If that is the shell, then those files will be sourced and their contents will be added to users' environments.
.csh
is for C Shell
which is an improved version of tsch
. If C Shell
is being used, then those files will instead be sourced and the contents added to users' environments.
You can add what you have to an existing file depending on what shell you are using but the best way is to create a new file with the respective extension and add what you have. Make sure that it is readable by all users.