nerdexam
Cisco

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.

Infrastructure and Automation

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)
  • A
    81% (51)
  • B
    5% (3)
  • D
    11% (7)
  • E
    3% (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`.

AA directory called PRODUCTION is created.Correct

The `mkdir PRODUCTION` command explicitly creates a new directory named "PRODUCTION" in the current working directory.

BThe engineer changes to the parent directory.

The `cd PRODUCTION` command changes the current directory *into* the newly created `PRODUCTION` directory, not to the parent directory.

CA YAML file is created.Correct

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.

DA YAML file is removed.

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.

EA directory called state.yml is created.

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

#Bash scripting#File system management#Directory creation#File creation

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice