102-500 Exam QuestionsBrowse all questions from this exam

102-500 Exam - Question 77


What is true about the file .profile in a user's home directory?

Show Answer
Correct Answer: CE

The .profile file in a user's home directory must use a valid shell script syntax because it is a shell initialization file used by the Bourne shell and compatible shells. It is sourced by the shell upon login hence it needs to follow the syntax rules of the shell script for proper execution. It does not need to be executable, call the binary of the login shell, start with a shebang, or be readable only for its owner.

Discussion

11 comments
Sign in to comment
VendoOption: C
Sep 14, 2020

The .profile was the original profile configuration for the Bourne shell (a.k.a., sh). bash, being a Bourne compatible shell will read and use it. Any shell providing bourne compatibility will read .profile. and thus, I believe is C true.

chris12augOption: C
Jun 7, 2022

-rw-r--r-- 1 ubuntu ubuntu 807 Jan 6 16:23 .profile A. It must be executable. (Wrong it is not) B. It must call the binary of the login shell. (No it is not necessary) C. It must use a valid shell script syntax. (correct) D. It must start with a shebang. (Wrong it does not start by shebang, it is called from /etc/profile file) E. It must be readable for its owner only. (Wrong it is not)

sigi63Option: C
Dec 2, 2020

The rights for the file are 644 shebang is not available C is the correct answer.

rb1353
Dec 4, 2020

I think I am misunderstanding something then, wouldn't valid shell script syntax include a shebang, so that would mean if c is true, then d must be true as well?

soullessone
Jan 30, 2022

I think all are misunderstanding the question. Everywhere the answer is C, but I think it is wrong and the permission is asked here. It must be r for all or user! I would go with E And Syntax is meant # !/bin/bash or what ever.

soullessone
Jan 30, 2022

shell scripts have a specific syntax: #!interpreter [optional-arg]

LazylinuxOption: C
Apr 18, 2022

C is correct ...E is wrong because ALL have Read permission check yourself on linux box D is WRONG as it doesnt not need to start with SHE Bang!!! oops typo Shebang..below is cut/paste of the actual file root@Debian:~# cat .profile # ~/.profile: executed by Bourne-compatible login shells. if [ "$BASH" ]; then if [ -f ~/.bashrc ]; then . ~/.bashrc fi fi mesg n 2> /dev/null || true

ilputtoOption: C
Nov 22, 2020

I think C is the correct answer

shahabOption: C
Feb 18, 2021

C is correct

dspaulaOption: D
Feb 23, 2022

C is correct

lucaverceOption: C
May 15, 2022

C is right "it must use a valid shell script syntax" obvious always respect the shell syntax E is wrong because the permission normally are 644

MchoetiOption: C
Apr 9, 2023

Option C my friends. The file .profile in a user's home directory must use a valid shell script syntax.

Robert12Option: D
Feb 5, 2022

I dont think C is correct , the .profile file does not have a shebang

NetOps_DaveOption: E
May 23, 2022

E is correct imho: The .profile file does not start with a !# so it does not follow shell scripting syntax. It does not need to be executable. The standard permissions are set to -rw-r--r-- so actually it is readable for everyone, but because it is in the users directory only the user is able to read it. I think that, because of the other answers are definitively not right, E is the most sane answer. Still an annoyingly confusing question though..

MaikyCR28
Jun 10, 2022

So, should the "others" be part of the group to have read access to it?