Questons & Answers - Linux Programming

Shell is a interface between user and the kernel. Even though there can be only one kernel ; a system can have many shell running simultaneously . Whenever a user enters a command through keyboard the shell communicates with the kernel to execute it and then display the output to the user.

input arguments into bash programming is like any normal command line program,where you can the arguments while you are executing.this can be done with special variables set aside for storing the arguments.the arguments are stored in variables with a number in the order of argument starting at 1 as $0 variable is the name of your script.

$? gives the exit status of the last command that was executed.


if [ condition ]	
then
      Execute the statements 
fi
	 
											

for [ variable_name ] in ...
do
    statement 1
	statement 2
	statement n
done
											

until [ condition ]
do
   statement 1
   statement 2
done
											

while [ condition ]
do
   statement 1
   statement 2
done
											

declare -a [ ARRAY_NAME ]
											

      0 – Standard Input

      1 – Standard Output

      2 – Standard Error

$$ gives the process id of the currently executing process whereas $! shows the process id of the process that recently went into background.


declare -a myarray

myarray[0] = 'Tutorials Studio'
myarray[1] = 'Veewom Technology'
myarray[2] =  'Quizer Studio'

echo ${myarray[0]}

#Output
#Tutorials Studio
										
Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!