200-901 · Question #367
Refer to the exhibit. A network engineer executes the bash script shown. Which two things are achieved by running the script? (Choose two.)
The correct answer is A. A directory called PRODUCTION is created. C. A YAML file is created. The Bash script first creates a new directory named PRODUCTION, then navigates into it, and finally creates and writes content to a new file named config.yaml.
Question
Refer to the exhibit. A network engineer executes the bash script shown. Which two things are achieved by running the script? (Choose two.)
Options
- AA directory called PRODUCTION is created.
- BThe engineer changes to the parent directory.
- CA YAML file is created.
- DA YAML file is removed.
- EA directory called state.yml is created.
How the community answered
(63 responses)- A81% (51)
- B5% (3)
- D11% (7)
- E3% (2)
Why each option
The Bash script first creates a new directory named `PRODUCTION`, then navigates into it, and finally creates and writes content to a new file named `config.yaml`.
The `mkdir PRODUCTION` command explicitly creates a new directory named "PRODUCTION" in the current working directory.
The `cd PRODUCTION` command changes the current directory *into* the newly created `PRODUCTION` directory, not to the parent directory.
The `touch config.yaml` command creates an empty file named "config.yaml", and the subsequent `echo "environment: production" >> config.yaml` command writes content into this newly created file, making it a functional YAML file.
The script uses `touch` and `echo >>` to create and write to a file; it does not contain any commands like `rm` to remove a YAML file.
The script creates a file named `config.yaml` and a directory named `PRODUCTION`, but it does not create a directory called `state.yml`.
Concept tested: Bash scripting for file and directory management
Source: https://man7.org/linux/man-pages/man1/mkdir.1.html
Topics
Community Discussion
No community discussion yet for this question.