Sunteți pe pagina 1din 4

Tech Interviews

Prepare for job interviews with the questions and answers asked by high-tech employers
.NET C++ Database General Hardware Java Networking Puzzles SAP ABAP Testing

Search Tech Interviews

Search

Unix/Linux

Unix/Linux >> Basic shell scripting questions

softhouseeducation.com/kursprogram

Ads by Google

Basic shell scripting questions


By admin | July 22, 2007

1. 2. 3. 4. 5. 6. 7. 8.

How do you find out whats your shell? - echo $SHELL Whats the command to find out todays date? - date Whats the command to find out users on the system? - who How do you find out the current directory youre in? - pwd How do you remove a file? - rm How do you remove a - rm -rf How do you find out your own username? - whoami How do you send a mail message to somebody? - mail somebody@techinterviews.com -s Your subject -c cc@techinterviews.com How do you count words, lines and characters in a file? - wc How do you search for a string inside a given file? - grep string filename How do you search for a string inside a directory? - grep string * How do you search for a string in a directory with the subdirectories recursed? grep -r string * What are PIDs? - They are process IDs given to processes. A PID can vary from 0 to 65535. How do you list currently running process? - ps How do you stop a process? - kill pid How do you find out about all running processes? - ps -ag How do you stop all the processes, except the shell window? - kill 0 How do you fire a process in the background? - ./process-name & How do you refer to the arguments passed to a shell script? - $1, $2 and so on. $0 is your script name. Whats the conditional statement in shell scripting? - if {condition} then fi How do you do number comparison in shell scripts? - -eq, -ne, -lt, -le, -gt, -ge How do you test for file properties in shell scripts? - -s filename tells you if the file is not empty, -f filename tells you whether the argument is a file, and not a directory, -d filename tests if the argument is a directory, and not a file, -w filename tests for writeability, -r filename tests for readability, -x filename tests for executability How do you do Boolean logic operators in shell scripting? - ! tests for logical not, a tests for logical and, and -o tests for logical or. How do you find out the number of arguments passed to the shell script? - $# Whats a way to do multilevel if-elses in shell scripting? - if {condition} then {statement} elif {condition} {statement} fi How do you write a for loop in shell? - for {variable name} in {list} do {statement} done How do you write a while loop in shell? - while {condition} do {statement} done How does a case statement look in shell scripts? - case {variable} in {possiblevalue-1}) {statement};; {possible-value-2}) {statement};; esac How do you read keyboard input in shell scripts? - read {variable-name} How do you define a function in a shell script? - function-name() { #some code here return } How does getopts command work? - The parameters to your script can be passed as -n 15 -x 20. Inside the script, you can iterate through the getopts array as while getopts n:x option, and the variable $option contains the value of the entered option.
softhouseeducation.com/kursprogram Ads by Google

9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22.

Ads by Google

Agile Acceptance Testing


3-day Workshop by Gojko Adzic London UK Oct 11-13th - don't miss
www.skillsmatter.com

QA Test Management Tool


Web based QA requirements, tests, results, reports. 30-day free trial
www.aptest.com

Automate system testing


General embedded software testing tool.
www.seqzap.com

Job Interview Question Articles


C# Interview Questions and Answers QTP Interview Questions and Answers C++ Interview Questions and Answers PHP Interview Questions and Answers XML Interview Questions and Answers JavaScript Interview Questions and Answers Asp.Net Interview Questions and Answers J2EE Interview Questions and Answers ABAP Interview Questions and Answers Perl Interview Questions and Answers Java Interview Questions and Answers

23. 24. 25. 26. 27. 28. 29. 30. 31.

Resources
Technology Question and Answer Website How to dance around the salary-expectation question 10 mistakes managers make during job interviews ID Maker Stupid interview questions How to Answer These Tricky Interview Questions Seven tips for writing an online profile for LinkedIn, MySpace or Facebook Video surveillance

This entry was posted in Unix/Linux. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

MySQL management interview questions

71 basic SQA / testing interview questions

Ads by Google

Ink cartridges

Programmr 200kr./time
Professionel IToutsourcing i Kina Programmering og Webudvikling
www.ChinaSoft.dk

Agile Acceptance Testing


3-day Workshop by Gojko Adzic London UK Oct 1113th - don't miss
www.skillsmatter.com

Laptop computers Affordable life insurance Ink cartridges

Tutorials
AJAX Tutorials Dealing with your job Getting a job JavaScript tutorials Job interview tips from Yahoo! HotJobs MySQL tutorials Retiring from your job Ruby on Rails tutorials

9 C OMME NTS ON BAS IC S HE LL S C R IPTING QUE S TIONS

Salary guide for IT jobs Self-employment TechInterviews guides in PDF Understanding pointers

Rajkumar
Posted 7/31/2007 at 11:22 pm | Permalink

XML Tutorials XUL tutorials

12)How do you search for a string in a directory with the subdirectories recursed? if not linux use the below command find / |xargs grep string

RSS Feeds
All posts All comments

Eswara moorthy
Posted 8/10/2007 at 5:37 pm | Permalink

How do u find the process ID for all services?? pgrep eg:pgrep mysql

teacher
Posted 8/17/2007 at 1:18 pm | Permalink

1) There are many shell scripting languages based on the shell being used. 2) Syntax for the scripting is based on the shell. 3) The syntax above would work for Bourne shell but many would not work for the C shell csh.

Shiv
Posted 10/26/2007 at 12:41 pm | Permalink

find ./ -exec grep string {} \;

Adam
Posted 3/5/2008 at 4:42 pm | Permalink

Hey guys im just wondering. im thinking about getting into game scripting and basic C++ does anyone have any tips for how to get started in something like this or computer science?

Comptan
Posted 6/25/2008 at 11:11 am | Permalink

What happens to a child process that dies and has no parent process to

wait for it and whats bad about this?

g.chalapathi
Posted 9/6/2008 at 7:54 am | Permalink

What is difference betwen shell scripting language and programing language ?

c sivakumar
Posted 11/1/2008 at 6:43 am | Permalink

We can take an example in solaris. If parent process dies while running child process below said things may happen:After complition of childs process task it will search the parent process if there is no parent process it may go defunct status and its status will be zombie mode. It will take swap space & memory space and also take load average. Rspective parent process cant not execute the particular child process in next instance. In this situation we have to kill that respective child process by manually.

c sivakumar
Posted 11/1/2008 at 6:45 am | Permalink

If parent process dies while running child process below said things may happen:After complition of childs process task it will search the parent process if there is no parent process it may go defunct status and its status will be zombie mode. It will take swap space & memory space and also take load average. Rspective parent process cant not execute the particular child process in next instance. In this situation we have to kill that respective child process by manually.

POS T A C OMME NT

Your email is never published nor shared. Required fields are marked *
Name * Email *

Website

Comment

Post Comment

Powered by WordPress. Built on the Thematic Theme Framework.

S-ar putea să vă placă și