Which of the following steps is not performed while creating a shell script?

  • Post author:
  • Post category:Blog
  • Post last modified:March 7, 2024
  • Reading time:2 mins read

Which of the following steps is not performed while creating a shell script?

  • Create a file with commands
  • Make the file executable
  • Login as root on the server console 
  • Put #!/bin/bash as the first line
Explanation & Hint:

The step that is not performed while creating a shell script is:

Login as root on the server console

Creating a shell script doesn’t necessarily require logging in as the root user on the server console. The other steps you mentioned are part of creating a shell script:

  1. Create a file with commands: This is the main content of the shell script, where you write the series of commands you want the script to execute.
  2. Make the file executable: You need to set the execute permission on the file to make it runnable as a script. This is typically done using the chmod command, which changes the file’s permission bits.
  3. Put #!/bin/bash as the first line: This is called a shebang line, and it specifies the interpreter (in this case, /bin/bash) that should be used to execute the script. This line is placed at the beginning of the script file.

Logging in as root is not a necessary step for creating a shell script, unless the script you are creating has a specific need to be run by the root user. Typically, you create and edit scripts as a regular user and then execute them with appropriate permissions based on the user’s requirements.

For more Questions and Answers:

NDG Introduction to Linux II 2.21 | Chapter 2: Shell Scripts Exam Answers