{"id":242,"date":"2010-04-16T00:00:00","date_gmt":"2010-04-16T00:00:00","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2010\/04\/16\/interview-questions-answer-sets-shell-programming\/"},"modified":"2021-02-27T09:53:56","modified_gmt":"2021-02-27T09:53:56","slug":"interview-questions-answer-sets-shell-programming","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/","title":{"rendered":"Interview Questions &#038; Answer Sets : Shell Programming"},"content":{"rendered":"<h3><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4281\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/04\/shell-programming-interview.png\" alt=\"shell-programming-interview\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/04\/shell-programming-interview.png 600w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/04\/shell-programming-interview-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/h3>\n<h3>Interview Questions Sets : Shell Programming<\/h3>\n<p><b>How do you find out what\u2019s your shell? <\/b><br \/>\nAnswer: echo $SHELL<\/p>\n<p><b>What\u2019s the command to find out today\u2019s date? <\/b><br \/>\nAnswer: date<\/p>\n<p><b>\u00a0What\u2019s the command to find out users on the system? <\/b><br \/>\nAnswer: who<\/p>\n<p><b>How do you find out the current directory you\u2019re in? <\/b><br \/>\nAnswer: pwd<\/p>\n<p><b>How do you remove a file? <\/b><br \/>\nAnswer: rm<\/p>\n<p><b>How do you remove a file?<\/b><br \/>\nAnswer: rm -rf<\/p>\n<p><b>How do you find out your own username? <\/b><br \/>\nAnswer: whoami<\/p>\n<p><b>How do you send a mail message to somebody? <\/b><br \/>\nAnswer: mail somebody@techinterviews.com -s \u2018Your subject\u2019 -c \u2018cc@techinterviews.com\u2018<\/p>\n<p><b>How do you count words, lines and characters in a file? <\/b><br \/>\nAnswer: wc<\/p>\n<p><b>How do you search for a string inside a given file? <\/b><br \/>\nAnswer: grep string filename<\/p>\n<p><b>How do you search for a string inside a directory? <\/b><br \/>\nAnswer: grep string *<\/p>\n<p><b>How do you search for a string in a directory with the subdirectories recursed? <\/b><br \/>\nAnswer: grep -r string *<\/p>\n<p><b>What are PIDs? <\/b><br \/>\nAnswer: They are process IDs given to processes. A PID can vary from 0 to 65535.<\/p>\n<p><b>How do you list currently running process? <\/b><br \/>\nAnswer: ps<\/p>\n<p><b>How do you stop a process? <\/b><br \/>\nAnswer: kill pid<\/p>\n<p><b>How do you find out about all running processes? <\/b><br \/>\nAnswer: ps -ag<\/p>\n<p><b>How do you stop all the processes, except the shell window? <\/b><br \/>\nAnswer: kill 0<\/p>\n<p><b>How do you fire a process in the background? <\/b><br \/>\nAnswer: .\/process-name &amp;<\/p>\n<p><b>How do you refer to the arguments passed to a shell script? <\/b><br \/>\nAnswer: $1, $2 and so on. $0 is your script name.<\/p>\n<p><b>What\u2019s the conditional statement in shell scripting? <\/b><br \/>\nAnswer: if {condition} then \u2026 fi<\/p>\n<p><b>How do you do number comparison in shell scripts? <\/b><br \/>\nAnswer: -eq, -ne, -lt, -le, -gt, -ge<\/p>\n<p><b>How do you test for file properties in shell scripts? <\/b><br \/>\nAnswer: -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<\/p>\n<p><b>How do you do Boolean logic operators in shell scripting? <\/b><br \/>\nAnswer: ! tests for logical not, -a tests for logical and, and -o tests for logical or.<\/p>\n<p><b>How do you find out the number of arguments passed to the shell script? <\/b><br \/>\nAnswer: $#<\/p>\n<p><b>What\u2019s a way to do multilevel if-else\u2019s in shell scripting? <\/b><br \/>\nAnswer: if {condition} then {statement} elif {condition} {statement} fi<\/p>\n<p><b>How do you write a for loop in shell? <\/b><br \/>\nAnswer: for {variable name} in {list} do {statement} done<\/p>\n<p><b>How do you write a while loop in shell? <\/b><br \/>\nAnswer: while {condition} do {statement} done<\/p>\n<p><b>How does a case statement look in shell scripts? <\/b><br \/>\nAnswer: case {variable} in {possible-value-1}) {statement};; {possible-value-2}) {statement};; esac<\/p>\n<p><b>How do you read keyboard input in shell scripts? <\/b><br \/>\nAnswer: read {variable-name}<\/p>\n<p><b>How do you define a function in a shell script? <\/b><br \/>\nAnswer: function-name() { #some code here return }<\/p>\n<p><b>How does getopts command work? <\/b><br \/>\nAnswer: 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.<\/p>\n<p><b>What\u2019s a way to do multilevel if-else\u2019s in shell scripting?<\/b><br \/>\nAnswer: if then elif fi<\/p>\n<p><b>How do you write a for loop in shell? <\/b><br \/>\nAnswer: for in do done<\/p>\n<p><b>How do you write a while loop in shell?<\/b><br \/>\nAnswer: while do done<\/p>\n<p><b>How does a case statement look in shell scripts? <\/b><br \/>\nAnswer: case in ) ;; ) ;; esac<\/p>\n<p><b>How do you define a function in a shell script?<\/b><br \/>\nAnswer: function-name()<\/p>\n<p><b>How do you find out about all running processes?<\/b><br \/>\nAnswer: ps -ag<\/p>\n<p><b>How do you stop a process? <\/b><br \/>\nAnswer: kill pid<\/p>\n<p><b>How do you remove a file?<\/b><br \/>\nAnswer: rm<\/p>\n<p><b>How do you remove recursively?<\/b><br \/>\nAnswer: rm -rf<\/p>\n<p><b>What are PIDs?<\/b><br \/>\nAnswer: They are process IDs given to processes. A PID can vary&#8230;<\/p>\n<p><b>How do you list currently running process?<\/b><br \/>\nAnswer: ps<\/p>\n<p><b>What is $$?<\/b><\/p>\n<p>What is a named pipe?<\/p>\n<p>What does || mean?<\/p>\n<p>What does &amp;&amp; mean?<\/p>\n<p>What is a loop?<\/p>\n<p>What does while do?<\/p>\n<p>What is a function?<\/p>\n<p><b>What are the different kinds of loops available in shell script?<\/b><br \/>\nfor if while case<\/p>\n<p><b>What does $# stand for?<\/b><\/p>\n<p>$# returns the number of parameters that are passed to a shell script<br \/>\n$? returns the exit code of the last executed command (0 : Successful, 1 or other: Failed)<\/p>\n<p><b>What does $? return?<\/b><br \/>\nWill return the status of the command which is executed lastly.<br \/>\n0 &gt; Success<br \/>\n2 &gt; Error<\/p>\n<p><b>How do u open a read only file in Unix?<\/b><br \/>\n&#8220;vi -R filename&#8221;<\/p>\n<p><b>What is the difference between a shell variable that is exported and the one that is not exported? <\/b><\/p>\n<p><b>If you have a string &#8220;one two three&#8221;, Which shell command would you use to extract the strings?<\/b><\/p>\n<p><b>How do you schedule a command to run at 4:00 every morning?<\/b><\/p>\n<p><b>How will you list only the empty lines in a file (using grep)? <\/b><br \/>\ngrep ^$ filename.txt<\/p>\n<p><b>When you login to a c shell, which script would be run first? (before the terminal is ready for the user) <\/b><\/p>\n<p>first \/etc\/.login script is run &amp; after that<br \/>\n~\/.login is run &amp; then ~\/.cshrc is run.<\/p>\n<p><b>How would you get the character positions 10-20 from a text file? <\/b><br \/>\ncat filename.txt | cut -c 10-20<\/p>\n<p><b>How would you print just the 25th line in a file (smallest possible script please)?<\/b><br \/>\ntail -n +25\u00c2 | head -1 OR<br \/>\nhead -n 25 | tail -1<\/p>\n<p><b>How would you replace the n character in a file with some xyz?<\/b><br \/>\nsed &#8216;s\/n\/xyz\/g&#8217; filename &gt; new_filename<\/p>\n<p>Grep | SED |<\/p>\n<p>How you will list the ordinary files in your current directory that are not user-writable?<\/p>\n<p>Use Command substitution with grep to list the names of the persons from emp.lst who were born today.<\/p>\n<p>How will you remove blank lines from a file using (i) grep\u00a0 and (ii) sed?<\/p>\n<p>Locate lines longer than 100 abd smaller than 150 characters using (i) grep\u00a0 and (ii) sed?<\/p>\n<p>How do you delete all leading and trailing spaces in all lines of a file?<\/p>\n<p><strong>Making Script Interactive<\/strong><br \/>\n# read name<br \/>\n# echo \u201c$name\u201d<\/p>\n<p><strong>Special Parameters Used by Shell<\/strong><br \/>\n# $* &#8211; It stores the complete set of positional parameters as a single string<br \/>\n# $? \u2013 Exit Status of last command<br \/>\n# $# &#8211; Number of arguments specified in command line<br \/>\n# $0 \u2013 Holds the command name itself<br \/>\n# $$ &#8211; PID of current Shell<br \/>\n# $! \u2013 PID of last the last Background job<\/p>\n<p><strong>Exit status of command<\/strong><br \/>\n# exit 0 \u2013 Used when everything went fine<br \/>\n# exit 1 \u2013 Used when something went wrong<\/p>\n<p>0 indicates the success and other values point to failure<\/p>\n<p><strong>The Logical Operator &amp;&amp; and ||<\/strong><br \/>\ncmd1 &amp;&amp; cmd2 &#8211; cmd2 is excuted only when cmd1 succeeds.<br \/>\ncmd1 || cmd2 &#8211; cmd2 is excuted only when cmd1 Fails<\/p>\n<p>Usage of \u2013a and -o<\/p>\n<p>The if Conditional<br \/>\nIf command is successful<br \/>\nthen<br \/>\nexecute command<br \/>\nelse<br \/>\nexecute command<br \/>\nfi<\/p>\n<p>If command is successful<br \/>\nthen<br \/>\nexecute command<br \/>\nfi<\/p>\n<p>If command is successful<br \/>\nthen<br \/>\nexecute command<br \/>\nelif command is successful<br \/>\nthen<br \/>\nexecute command<br \/>\nelse<br \/>\nexecute command<br \/>\nfi<\/p>\n<p><strong>Using test AND [ ] to evaluate expressions<\/strong><br \/>\n# test $x \u2013eq $y<br \/>\n# [$x \u2013eq $y]<\/p>\n<p><strong>Numeric Comparison Operators used by test<\/strong><br \/>\n# -eq \u2013 Equal to<br \/>\n# -ne \u2013 Not Equal to<br \/>\n# -gt \u2013 Greater than<br \/>\n# -ge \u2013 Greater than or equal to<br \/>\n# -ge \u2013 Less than<br \/>\n# -le \u2013 Less than or equal to<\/p>\n<p><strong>String Tests used by test<\/strong><\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"319\"><strong>Test<\/strong><\/td>\n<td valign=\"top\" width=\"319\"><strong>True if<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"319\"><strong>s1=s2<\/strong><\/td>\n<td valign=\"top\" width=\"319\">String s1 = s2<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"319\"><strong>s1 != s2<\/strong><\/td>\n<td valign=\"top\" width=\"319\">String s1 is not equal to s2<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"319\"><strong>-n stg<\/strong><\/td>\n<td valign=\"top\" width=\"319\">String stg is not a null string<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"319\"><strong>-z stg<\/strong><\/td>\n<td valign=\"top\" width=\"319\">String stg is a null string<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"319\"><strong>stg<\/strong><\/td>\n<td valign=\"top\" width=\"319\">String stg is assigned and not null<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"319\"><strong>s1 == s2<\/strong><\/td>\n<td valign=\"top\" width=\"319\">String s1 =s2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>File related Tests with test<br \/>\n<\/strong><\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"272\"><strong>Test<\/strong><\/td>\n<td valign=\"top\" width=\"367\"><strong>True if<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"272\"><strong>-f file<\/strong><\/td>\n<td valign=\"top\" width=\"367\">file exists and is a regular file<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"272\"><strong>-r file<\/strong><\/td>\n<td valign=\"top\" width=\"367\">file exists and is a readable<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"272\"><strong>-w file<\/strong><\/td>\n<td valign=\"top\" width=\"367\">file exists and is a writeable<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"272\"><strong>-x file<\/strong><\/td>\n<td valign=\"top\" width=\"367\">file exists and is a executable<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"272\"><strong>-d file<\/strong><\/td>\n<td valign=\"top\" width=\"367\">file exists and is a dirctory<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"272\"><strong>-s file<\/strong><\/td>\n<td valign=\"top\" width=\"367\">file exists and has a size greate than ero<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"272\"><strong>-e file<\/strong><\/td>\n<td valign=\"top\" width=\"367\">file exists<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"272\"><strong>-u file<\/strong><\/td>\n<td valign=\"top\" width=\"367\">file exists and has\u00a0 SUID bit set<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"272\"><strong>-L file<\/strong><\/td>\n<td valign=\"top\" width=\"367\">file exists and is a Symbolic link<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>The case CONDITIONAL<\/strong><br \/>\nread choice<br \/>\ncase \u201c$choice\u201d in<\/p>\n<ul>\n<li>ls \u2013l ;;<\/li>\n<li>ps \u2013f ;;<\/li>\n<li>date ;;<\/li>\n<li>who ;;<\/li>\n<li>exit ;;<\/li>\n<\/ul>\n<p>*)\u00a0\u00a0 echo \u201cInvalid options\u201d<br \/>\nesac<\/p>\n<p><strong>for<\/strong><br \/>\nfor variable in list<br \/>\ndo<br \/>\ncommands<br \/>\ndone<\/p>\n<p>for file in *.htm *.html<br \/>\ndo<br \/>\nsed \u2018s\/strong\/STONG\/g\u2019 $file &gt;&gt; $$<br \/>\nmv $$ $file<br \/>\ngzip $file<br \/>\ndone<\/p>\n<p><strong>while<\/strong><\/p>\n<p>while consition is true<br \/>\ndo<br \/>\ncommands<br \/>\ndone<\/p>\n<p><strong>basename \u2013 Changing Filename Extension<\/strong><br \/>\n# basename \/home\/henry\/project3\/dec2bin.pl<br \/>\n#dec2bin.pl<br \/>\n# basename ux2nd.txt txt<br \/>\n# ux2nd.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211; txt stripped off<\/p>\n<p><strong>set \u00a0AND shift \u2013 Manupulating the Positional Parameters<\/strong><br \/>\n# set 9876 2345 6213<br \/>\n# echo \u201c\\$1 is $1, \\$2 is $2, \\$3 is $3\u201d<br \/>\n# $1 is 9876, $2 is 2346, $3 is 6213<\/p>\n<p># set `date`<br \/>\n# echo $*<\/p>\n<p>Note- set parses its arguments on the delimiters specified in the environment variable IFS which by default is whitespace.<\/p>\n<p><strong>Shift \u2013 Shifting arguments left<\/strong><\/p>\n<p><strong>Maximum number of Bash arguments<\/strong><br \/>\nOn a 32-bit Linux, this is ARGMAX\/4-1 (32767). This becomes relevant if the average length of arguments is smaller than 4.<br \/>\nLinux 2.6.23, one argument must not be longer than MAX_ARG_STRLEN (131072).<\/p>\n<p><strong>How to find success\/failure status of a command in different shells?<\/strong><br \/>\necho $?<br \/>\n<strong>List all the users in Linux<\/strong><br \/>\ncat \/etc\/passwd | cut -d&#8221;:&#8221; -f1<\/p>\n<p><strong>How to change the permission of multiple files which has 655 to 755<\/strong><br \/>\nfor myfile in `find . -perm 655`<br \/>\ndo<br \/>\nchmod 755 $myfile<br \/>\ndone<\/p>\n<p><strong>Shell script to Print only Size and file name using unix command<\/strong><br \/>\nls -l | tr -s &#8221; &#8221; &#8221; &#8220;| cut -d &#8221; &#8221; -f5,9<\/p>\n<p><strong>Shell script to read file line by line<\/strong><br \/>\n<a href=\"forum\/shell-script\/shell-script-to-read-file-line-by-line.html\">http:\/\/www.scmgalaxy.com\/forum\/shell-script\/shell-script-to-read-file-line-by-line.html<\/a><\/p>\n<p><strong>How do you remove blank line using grep and sed in shell scripting? <\/strong><br \/>\n# grep -v &#8220;^$&#8221; filename &gt; newfilename<br \/>\n# sed &#8216;\/^$\/d&#8217; \/tmp\/data.txt &gt; \/tmp\/output.txt<br \/>\n# sed &#8216;\/^[PRESS TAB]*$\/d&#8217; filename<\/p>\n<p><strong>List all the Groups and users in linux<\/strong><br \/>\n# less \/etc\/passwd<br \/>\n# less \/etc\/group<\/p>\n<p><strong>How Do I Find Out CPU is 32bit or 64bit?<\/strong><\/p>\n<p># grep flags \/proc\/cpuinfo<br \/>\n# uname<\/p>\n<p><strong>How to gunzip and untar all at once!<\/strong><br \/>\ngunzip myfile.tar.gz<br \/>\ntar -xvf myfile.tar<br \/>\ninto one<br \/>\ntar -zxvf myfile.tar.gz<\/p>\n<p><strong>Another way to kill multiple processes easily is by adding the following two functions to the .bash_profile.<\/strong><br \/>\nfunction psgrep ()<br \/>\n{<br \/>\nps aux | grep &#8220;$1&#8221; | grep -v &#8216;grep&#8217;<br \/>\n}<\/p>\n<p>function psterm ()<br \/>\n{<br \/>\n[ ${#} -eq 0 ] &amp;&amp; echo &#8220;usage: $FUNCNAME STRING&#8221; &amp;&amp; return 0<br \/>\nlocal pid<br \/>\npid=$(ps ax | grep &#8220;$1&#8221; | grep -v grep | awk &#8216;{ print $1 }&#8217;)<br \/>\necho -e &#8220;terminating &#8216;$1&#8217; \/ process(es):\\n$pid&#8221;<br \/>\nkill -SIGTERM $pid<br \/>\n}<\/p>\n<pre>  # psgrep http<\/pre>\n<pre><\/pre>\n<pre>USER\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 PID %CPU %MEM\u00a0\u00a0\u00a0 VSZ\u00a0\u00a0\u00a0 RSS TTY\u00a0 STAT START\u00a0 TIME COMMAND<\/pre>\n<pre>apache\u00a0\u00a0 31186\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0.0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1.6\u00a0 23736 17556 ?\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 S\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Jul26\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0:40\u00a0 \/usr\/local\/apache2\/bin\/httpd<\/pre>\n<pre>apache\u00a0 \u00a031187\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0.0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1.3\u00a0 20640 14444 ?\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 S\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Jul26\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0:37\u00a0 \/usr\/local\/apache2\/bin\/httpd<\/pre>\n<pre><\/pre>\n<pre># psterm httpd<\/pre>\n<pre><\/pre>\n<pre>terminating 'httpd' \/ process(es):<\/pre>\n<pre>31186<\/pre>\n<pre>31187<\/pre>\n<pre><\/pre>\n<pre><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Interview Questions Sets : Shell Programming How do you find out what\u2019s your shell? Answer: echo $SHELL What\u2019s the command [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":4281,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[52],"tags":[767,766,3909,507,1553,3902,482,1830,3910,138,3903,3904,3908,3907,3906,3905,637],"class_list":["post-242","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-interview-questions-answers","tag-answer","tag-interview","tag-interview-questions-answer-for-shell-programming","tag-list","tag-most-asked","tag-programming","tag-questions","tag-selected","tag-sets","tag-shell","tag-shell-programming","tag-shell-programming-interview","tag-shell-programming-interview-guide","tag-shell-programming-interview-qa","tag-shell-programming-interview-questions-answer","tag-shell-programming-job-interview","tag-top"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Interview Questions &amp; Answer Sets : Shell Programming - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Interview Questions &amp; Answer Sets : Shell Programming - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"Interview Questions Sets : Shell Programming How do you find out what\u2019s your shell? Answer: echo $SHELL What\u2019s the command [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2010-04-16T00:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-27T09:53:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/04\/shell-programming-interview.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"scmgalaxy K\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"scmgalaxy K\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/\"},\"author\":{\"name\":\"scmgalaxy K\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\"},\"headline\":\"Interview Questions &#038; Answer Sets : Shell Programming\",\"datePublished\":\"2010-04-16T00:00:00+00:00\",\"dateModified\":\"2021-02-27T09:53:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/\"},\"wordCount\":1724,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2010\\\/04\\\/shell-programming-interview.png\",\"keywords\":[\"Answer\",\"Interview\",\"Interview Questions &amp; Answer for Shell Programming\",\"list\",\"Most Asked\",\"Programming\",\"Questions\",\"Selected\",\"Sets\",\"Shell\",\"Shell Programming\",\"Shell Programming Interview\",\"Shell Programming Interview Guide\",\"Shell Programming Interview Q&amp;A\",\"Shell Programming Interview Questions &amp; Answer\",\"Shell Programming Job Interview\",\"Top\"],\"articleSection\":[\"Interview Questions &amp; Answers\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/\",\"name\":\"Interview Questions & Answer Sets : Shell Programming - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2010\\\/04\\\/shell-programming-interview.png\",\"datePublished\":\"2010-04-16T00:00:00+00:00\",\"dateModified\":\"2021-02-27T09:53:56+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2010\\\/04\\\/shell-programming-interview.png\",\"contentUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2010\\\/04\\\/shell-programming-interview.png\",\"width\":600,\"height\":400,\"caption\":\"shell-programming-interview\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/interview-questions-answer-sets-shell-programming\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Interview Questions &#038; Answer Sets : Shell Programming\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\",\"name\":\"scmgalaxy K\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"caption\":\"scmgalaxy K\"},\"sameAs\":[\"http:\\\/\\\/www.DevOpsSchool.com\"],\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/scmgalaxy\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Interview Questions & Answer Sets : Shell Programming - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/","og_locale":"en_US","og_type":"article","og_title":"Interview Questions & Answer Sets : Shell Programming - scmGalaxy","og_description":"Interview Questions Sets : Shell Programming How do you find out what\u2019s your shell? Answer: echo $SHELL What\u2019s the command [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/","og_site_name":"scmGalaxy","article_published_time":"2010-04-16T00:00:00+00:00","article_modified_time":"2021-02-27T09:53:56+00:00","og_image":[{"width":600,"height":400,"url":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/04\/shell-programming-interview.png","type":"image\/png"}],"author":"scmgalaxy K","twitter_card":"summary_large_image","twitter_misc":{"Written by":"scmgalaxy K","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/"},"author":{"name":"scmgalaxy K","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102"},"headline":"Interview Questions &#038; Answer Sets : Shell Programming","datePublished":"2010-04-16T00:00:00+00:00","dateModified":"2021-02-27T09:53:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/"},"wordCount":1724,"commentCount":0,"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/#primaryimage"},"thumbnailUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/04\/shell-programming-interview.png","keywords":["Answer","Interview","Interview Questions &amp; Answer for Shell Programming","list","Most Asked","Programming","Questions","Selected","Sets","Shell","Shell Programming","Shell Programming Interview","Shell Programming Interview Guide","Shell Programming Interview Q&amp;A","Shell Programming Interview Questions &amp; Answer","Shell Programming Job Interview","Top"],"articleSection":["Interview Questions &amp; Answers"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/","name":"Interview Questions & Answer Sets : Shell Programming - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/#primaryimage"},"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/#primaryimage"},"thumbnailUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/04\/shell-programming-interview.png","datePublished":"2010-04-16T00:00:00+00:00","dateModified":"2021-02-27T09:53:56+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/#primaryimage","url":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/04\/shell-programming-interview.png","contentUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/04\/shell-programming-interview.png","width":600,"height":400,"caption":"shell-programming-interview"},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/interview-questions-answer-sets-shell-programming\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Interview Questions &#038; Answer Sets : Shell Programming"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102","name":"scmgalaxy K","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","caption":"scmgalaxy K"},"sameAs":["http:\/\/www.DevOpsSchool.com"],"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/scmgalaxy\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=242"}],"version-history":[{"count":1,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/242\/revisions"}],"predecessor-version":[{"id":4282,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/242\/revisions\/4282"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media\/4281"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}