BTEP maintains several Question and Answer Forums of interest to the NCI/CCR community.
Currently, there are forums on these topics listed below:
If you wish to ask a question go to the Ask Question Page and submit your question.
what does -f stand for in the bash profile setup?
Hi. Could you please help to explain what is the meaning of [-f ~/.bashrc] in the bashprofile setup below? Thanks
#
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
1 Answer:
The "[ -f ~/.bashrc]" is known as a test command in bash. This command, which includes the "-f" expression, will check if the ~/.bashrc file exists (i.e. the file .bashrc is in your home directory) and is a regular file (i.e. is not a directory).
If the expression [ -f ~/.bashrc] is true, then the program will run the "source ~/.bashrc" command.
For info on other bash expressions http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
Answered on April 30th, 2020 by desiree.tillo@nih.gov