Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Tips and Tricks with Shell Programming.

Every one wants to become master in Linux. what actually need is to understand the shortcuts and needs patience to understand how each Command works. Lets take a simple example  of how ls command works. That will give a better idea of the system calls involved and also will give a clear idea of how the inode number works.

What is the importance of Parameter $?
Parameter $? stores the exit status of the last command

When I can use the parameter $?
parameter $? can be used in scenarios where we want to execute some commands based on the status of the last command
The other scenario is if we want to display the status of the last executed command

How I can increase the size of the history command
$HISTSIZE is the built in variable which can be altered to increase/decrease the size of the history command

What are the operators used as logical and conditional execution in bash Shell programing
$$ is used as Logical and operator
|| is used as Logical or operator

How to identify the process id of last background job
$! can be used

How to use the command line arguments in shell programming
if we execute the shell programming as
shell_name arg1 arg2 arg3 arg4
for_instance
run_program 12 13 14 15

Here 
$0 is run_program, which is the program name
$1 is 12
$2 is 13
$3 is 14
$4 is 15
$# is 4 which is total number of command line arguments 


  



This post first appeared on All About Linux, please read the originial post: here

Share the post

Tips and Tricks with Shell Programming.

×

Subscribe to All About Linux

Get updates delivered right to your inbox!

Thank you for your subscription

×