Shell Bash Scripting Interview Questions and Answer – Part 3

  1. How can I print shell script name?
  2. How to write a script when the first command is executed then execute the below script?
  3. Can you tell me the syntax for for loop and while loop?
  4. How to print shell name?
  5. How to assign a all the arguments to a single variable?
  6. How to print the current processid of current shell?
  7. How to know the file that is entering randomly to my script?
  8. How to divide two variables in shell script?
  9. What is trap?
  10. What is shift in shell script?
  11. How to run our script in background?
  12. How to know the running back ground process id ?
  13. What is $*, $$ and $@?
  14. How to print only directories?
  15. How to print the directory only started with number?
  16. How to grep two strings at a time?
  17. How to grep a string that is started with some string and ends with some string like a…..b ?
  18. How to print string that starts with a?
  19. Did you worked on arrays?
  20. How will you give access of your script to a particular user?
  21. How to access background running scripts and their pid?
  22. How to run our script in foreground?
Rajesh Kumar
Follow me