Shell script face questions and answers

1. What is a shell script?

shell script is a text file that contains the command contains one or more commands.

2. Why use a shell script?

System administrators use it to issue a number of commands to accomplish the task. All commands in a text file (shell script) is added together to complete the daily routine tasks.

3. shell script What are the advantages (benefits)?

These are the two main advantages of shell scripts:

  • It can help you develop your own operating system, includes the most suitable related functions.
  • Applications can according to their own design software platform.
  • Used to manage and maintain the system.

4. shell script what are the disadvantages?

Here are the main disadvantages of shell scripts:

  • Weak design could undermine the whole process, and can lead to costly mistakes.
  • If you type an error occurs during creation, it can delete the entire data and partition data.
  • Its initial process is slow and gradual improvement.
  • Portability between different operating systems is poor.

5. shell variables used in the script what type?

shell script uses two types of variables:

  • System-defined variables : These variables themselves are defined or created by the operating system.
  • User-defined Variables : These variables are defined by the system user.

6. shell script what syntax "nested if statements" are?

About the shell script "nested if statements" syntax, refer to the following code -

if [ Condition ]  
then  
    command1  
    command2  
    .....  
else  
if [ condition ]  
then  
    command1  
    command2  
    .....  
else  
    command1  
    command2  
    .....

 

7.  $?identify what's the use in a shell script?

When writing a shell script $?to identify and ifserve to check whether the statement on the successful execution of a command.

8. In the Shell breakcommand what is the use?

breakCommand is used to interrupt the ongoing exit from the loop.

9. What is a GUI script (application)?

GUI represents the graphical user interface. For controlling the computer and its applications. GUI scripting support different applications. It mainly depends on the operating system.

What experiences 10. Linux / Unix process several stage?

Linux / Unix process typically goes through four stages:

  • Wait : At this stage, Linux processes are waiting for resources.
  • Run : At this stage, Linux currently executing process.
  • Stop : At this stage, Linux process stops after a successful execution.
  • Zombie : This stage, known as zombies, because the process has stopped but still in the process table is active.

11. Can replace "ls" command position "echo" command?

can.

What 12. shell script syntax of the while loop is?

while loop is repeated for multiple command block. It Unlike the for loop, while it iterates until the condition is no longer true.

while [ test_condition ]  
do  
    commands...  
done

13. The soft links and hard links What is the difference?

Inode : Each file contains a called "inode" index number, the index number of metadata about the composition of the relevant documents.

Hard link : the link is a mirror image of the original document. In this case, the hard links and the original files containing the same inode. Whether or not delete the original file, the link remains hard links.

 

Soft links : Shortcut functions like the Windows operating system. In this case, the hard links and the original files containing different inode. If you delete the original file, soft links will not work.

 

14. Shell scripts $#What is the purpose identifier is? 

Shell script $#identifier display the total number of parameters passed to the script.

15. What is a zombie?

Zombie process is a process of death, but the parent did not opt ​​out of state.

16. Linux in three standard streams What?

Linux in three standard streams are:

  • 0 - standard input
  • 1 - Standard Output
  • 2 - standard error
Published 72 original articles · won praise 7 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_39399966/article/details/104345420
Recommended