XK0-004 · Question #258
The following represents a partial listing of a user's .bashrc file: HISTSIZE=800 HISTFILESIZE=1000 umask 2002 HISTCONTROL=ignoreboth When the user opens a terminal, an error message appears: Octal…
The correct answer is C. umask 2002. The umask command expects an octal value in the range 0000-0777, and the value 2002 (octal) equals 1026 decimal, which exceeds the valid range and triggers an 'Octal number out of range' error.
Question
The following represents a partial listing of a user's .bashrc file:
HISTSIZE=800 HISTFILESIZE=1000 umask 2002 HISTCONTROL=ignoreboth When the user opens a terminal, an error message appears:
Octal number out of range Which of the following lines in the partial .bashrc should be modified to prevent the error from occurring?
Options
- AHISTSIZE=800
- BHISTFILESIZE=1000
- Cumask 2002
- DHISTCONTROL=ignoreboth
How the community answered
(25 responses)- A4% (1)
- B4% (1)
- C84% (21)
- D8% (2)
Why each option
The umask command expects an octal value in the range 0000-0777, and the value 2002 (octal) equals 1026 decimal, which exceeds the valid range and triggers an 'Octal number out of range' error.
HISTSIZE=800 is a valid integer assignment controlling the number of commands retained in the history list and does not involve octal notation.
HISTFILESIZE=1000 is a valid integer assignment controlling the maximum number of lines in the history file and does not involve octal notation.
The umask value 2002, when interpreted as octal, equals 1026 in decimal, which exceeds the valid umask range of 0 to 0777 (octal). The shell reports 'Octal number out of range' because umask only accepts values from 0000 to 0777 octal. Correcting it to a valid value such as 0002 or 0022 would resolve the error.
HISTCONTROL=ignoreboth is a valid string assignment controlling how duplicate and space-prefixed commands are handled in history and does not involve octal notation.
Concept tested: Linux umask valid octal range configuration
Source: https://www.gnu.org/software/bash/manual/bash.html#index-umask
Topics
Community Discussion
No community discussion yet for this question.