Here are all the actual test exam dumps for IT exams. Most people prepare for the actual exams with our test dumps to pass their exams. So it's critical to choose and actual test pdf to succeed.

Exam 010-160 Topic 10 Question 11 Discussion

Actual exam question for Lpi's 010-160 exam
Question #: 11
Topic #: 10
The current directory contains the following file:
-rwxr-xr-x 1 root root 859688 Feb 7 08:15 test.sh
Given that the file is a valid shell script, how can this script be executed? (Choose two correct answers.)

Suggested Answer: D,E Vote an answer

Explanation
A shell script is a file that contains a series of commands that can be executed by a shell interpreter. To execute a shell script, there are two main methods:
* Method 1: Specify the path to the script file. This method requires that the script file has the execute permission, which can be granted by using the chmod command. The script file also needs to have a shebang line at the beginning, which indicates which interpreter to use for the script. For example, #!/bin/bash means to use the bash interpreter. To execute the script using this method, you can type the absolute path or the relative path to the script file. If you are in the same directory as the script file, you can use the ./ prefix to indicate the current directory. For example,
./test.sh will execute the test.sh script in the current directory.
* Method 2: Pass the script file as an argument to the interpreter. This method does not require the execute permission or the shebang line for the script file. You can simply use the name of the interpreter followed by the script file name as an argument. For example, bash test.sh will execute the test.sh script using the bash interpreter.
Therefore, the correct answers are D and E. A. run test.sh is incorrect because run is not a valid command in Linux. B. ${test.sh} is incorrect because this syntax is used for variable expansion, not for executing a script. C. cmd ./test.sh is incorrect because cmd is not a valid command in Linux. References:
* Linux Essentials Topic 105: The Power of the Command Line, section 105.3: Basic shell scripting.
* How to Run a Shell Script in Linux [Essentials Explained] - It's FOSS
* How To Execute a Command with a Shell Script in Linux | DigitalOcean
* How To Run the .sh File Shell Script In Linux / UNIX

by Queena at Oct 25, 2024, 04:34 PM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.