Shell Scripting

Shell Scripting

For , making a script for installation and configuration of OSM I am going to learn “Shell scripting”

Variables are case-sensitive, just like filename in Linux.

Quotes
Name
Meaning
Double Quotes “Double Quotes” – Anything enclose in double quotes removed meaning of that characters (except \ and $).
Single quotes ‘Single quotes’ – Enclosed in single quotes remains unchanged.
` Back quote `Back quote` – To execute command

Example:

$ echo “Today is date”

Today is date

$ echo “Today is `date`”

Today is Sun Jul 17 17:53:07 IST 2016

ls *.c

Show all files with extension c

The sed utility is a batch (noninteractive) editor.The sed commands are usually stored in a script-file . . .although you can give simple sed commands from the command line

If you need a particular command within the script to be run without sudo privileges, you can run it as a regular user with

sudo -u username command

sed s/day/night/

where s means substitute

 

sed -i ‘s/hello/new/g’ rakesh.txt
sudo  apt-get -y install littler

sed -i '/TEXT_TO_BE_REPLACED/c\This line is removed by the admin.' /tmp/foo

sed 's/.*TEXT_TO_BE_REPLACED.*/This line is removed by the admin./'

sed -i s@/usr/bin@/home/amishuser@ rakesh.sh

sed -n ‘N’p filename

example.    sed -n 3p rakesh.sh

What is a pbf file?

PBF is a backup archive file created by a Paragon backup and recovery applications. It stores backup files in a proprietary format, and can be browsed within the software which also enables restore for individual files or a whole file system.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s