What is true about the file .profile in a user's home directory?
What is true about the file .profile in a user's home directory?
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.
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.
-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)
The rights for the file are 644 shebang is not available C is the correct answer.
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?
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.
shell scripts have a specific syntax: #!interpreter [optional-arg]
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
I think C is the correct answer
C is correct
C is correct
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
Option C my friends. The file .profile in a user's home directory must use a valid shell script syntax.
I dont think C is correct , the .profile file does not have a shebang
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..
So, should the "others" be part of the group to have read access to it?