Try `mkdir fail_dir && cd fail_dir`.

QuestionsQuestions8 SkillsProDec, 14 2025
091

That's an excellent command to try, and it highlights how && works!

When you execute mkdir fail_dir && cd fail_dir:

  1. mkdir fail_dir will first attempt to create a directory named fail_dir.
  2. If mkdir fail_dir succeeds (meaning fail_dir was created without issues), then the command cd fail_dir will be executed, and you will change your current directory into fail_dir.
  3. If mkdir fail_dir fails (for example, if a directory named fail_dir already exists, or you don't have the necessary permissions), then the cd fail_dir command will not be executed. This is the beauty of && – it prevents you from trying to cd into a directory that wasn't successfully created.

Go ahead and type mkdir fail_dir && cd fail_dir into your terminal.

What do you observe? If you run it a second time, what happens then? Let Labby know!

0 Comments

no data
Be the first to share your comment!