Friday, November 29, 2013

Omelet by me

Last Monday.. i try to create my own omelete.

Below is the ingredient:
- 4 eggs
- 2 eatspoon of maizena
- 1 indomie
- half can of Chicken cornet
- 2 clove of garlic
- 2 clove of onion




first of all i boiled the noodle (indomie)


and then i mix all the ingredient in one bowl (egg, maizena, etc) and stir the ingredient.
after that i put the dough in frypan and i mix the boiled noodle with the dough.
below is the picture for the result:


after that i eat the omelete with rice. and i also give tomato sauce.
nyummy. :p



Selection And Repetition Part II

Last time we already learn about selection and repetition using test and operator
right now we will use if,case, for,while, until and select

if

below is the example

#!/bin/bash

key="bash";
read -s -p "Your Password : " pass
if [ $pass==$kunci ]; then
    echo "Success, You are able to login"
else
    echo "Sorry, Your password is wrong";
fi

below is the result

[elvin@TestBed$]./if2
Password anda : bash
Success, You are able to login
[fajar@linux$]./if2
Password anda : Bash
Sorry, Your password is wrong

else will be execute if the condition is not being fulfilled

below is the example of nested if
#!/bin/bash

clear
echo "Menu of the day";
echo "---------------";
echo "1. Noodle    ";
echo "2. Satay     ";
echo "3. Exit      ";
read -p "Your choose [1-3] :" pil;

if [ $pil -eq 1 ]; 
then
   echo "How Many =";
   read sum
   let pay=sum*1500;
elif [ $pil -eq 2 ]; 
then
   echo "How Many =";
   read sum
   let pay=sum*2000;
elif [ $pil -eq 3 ]; 
then
   exit 0
else
   echo "Sorry, Your choose is not available"
   exit 1
fi

echo "Total Payment = Rp. $pay"
echo "THX"

below is the result

[elvin@TestBed$]./if3
Menu of the day
---------------
1. Noodle   
2. Satay 
3. Exit    
Your choose[1-3] :2

How Many = 2

Total Payment = Rp. 4000
THX

case

the function of case is same like if. for sometimes condition, case is more efficience than if command

below is the example

#!/bin/bash

clear
echo -n "Please input your menu :";
read menu;

case $menu in
    noodle | kwetiau | bihun ) echo "$menu is chinese food"
                  break   
                              ;;
    steak | pizza | sandwich ) echo "$menu is western food"
                  break
                  ;;
    *) echo "$menu is not being defined"
                  break
                  ;;
esac

below is the result

[elvin@TestBed$]./cs1
Please input your menu : noodle 
noodle is chinese food

for

for statement is using for repetition

below is the example
#!/bin/bash

for number in 1 2 3 4 5;
do
   echo "number=$number";
done
below is the result

[elvin@TestBed$]./for1
number=1
number=2
number=3
number=4
number=5

while

while statement will do the command as long as the condition is true

below is the example to print odd number

#!/bin/bash

i=1;
while [ $i -le 10 ];
do
  echo "$i,";
  let i=$i+2;
done

below is result

[elvin@TestBed$]./wh1
1,3,5,7,9,

until

until statement will do the command if the condition is false

below is the example

#!/bin/bash

i=1;
until [ $i -gt 10 ];
do
  echo $i;
  let i=$i+1
done

below is the result

[elvin@TestBed$]./ut
1,2,3,4,5,6,7,8,9,10,

select

below is the example

#!/bin/bash
#menu1

clear
select menu
do
  echo "you choose $REPLY is $menu"
done

below is the result
layout:
[elvin@Testbed$]./menu1 Slackware Redhat Mandrake
1) Slackware
2) Redhat
3) Mandrake
 #? 1
you choose 1 is Slackware



Thursday, November 28, 2013

First Step: Pay God first

Dalam perencanaan financial, kita penah mendengar suatu prinsip dasar yaitu pay yourself first.
Prinsip ini mengajarkan kita untuk setiap kali menerima uang dari pendapatan kerja, kita harus segera mengalokasikan beberapa persennya untuk di tabung atau di investasikan. kemudian untuk memenuhi kebutuhan dan sisanya untuk membiayai kesenangan kita.


Metode ini "memaksa" kita mendahulukan kependingan pribadi demi menjaga kehidupan financial kita tetap aman. Seperti kata pepatah "Save us for rainy rainy day" atau seperti membeli/membawa payung sebelum hujan.

Ketika saya membaca buku 6 Keranjang 7 Langkah, saya mempelajari satu langkah pertama yang dilakukan sebelum pay yourself first yaitu Pay God First. Saya sangat setuju dengan pandangan si penulis. Saya sangat percaya bahwa berkat berasal dari Sang Pencipta. Uang yang kita terima adalah titipan dan kita adalah pengelolanya. Dan ketika di akhir nanti, kita akan diminta pertanggung jawabannya atas penggunaan setiap uang kita.

Di saat ini, daya tarik uang semakin sulit untuk dihiraukan. Segala sesuatu membutuhkan uang, dan sadar atau tidak, tidak sedikit dari kita yang berpikiran uang adalah segala-galanya dalam hidup. Keluarga saya adalah contohnya. akan tetapi saya menyadari bahwa kehidupan ini tidak didapat dari "Dewa uang".
Hidup kita adalah anugerah Yang Maha Esa, Sang Pencipta. Oleh karena itu, prinsip ini sangat penting dan menjadi pondasi paling awal untuk perencanaan financial. Prinsip ini juga membuat pikiran kita lebih jernih dan mampu membuat prioritas utama dalam hidup kita.

Memberi = Menerima

Saya mempunyai sebuah kisah menarik tentang memberi:

Ada dua laut di Palestina. Satu sama lain saling berhubungan dan sangat berbeda. Yang satu disebut laut Galilea. Yang satu lagi dinamakan laut Mati. Laut Galilea adalah danau yang luas dengan air yang bersih dan di sekitarnya banyak kehidupan seperti banyak ditemukan berbagai jenis ikan, banyak tanaman hijau dan banyak orang membangun rumah di sekitarnya. Sedangkan pada laut yang lain (laut mati). Sungguh cocok dengan namanya, semuanya mati. Tiada kehidupan dalam laut ini. Dan laut ini kadar keasinannya lebih banyak 9x dibandingkan laut di sekitarnya. Di sekitar laut ini tidak ada kehidupan, dan apabila orang mencoba meminum air ini maka orang yang meminumnya akan sakit. Tidak ada seorangpun yang tinggal di dekatnya karena baunya yang tidak enak.
Dari Kedua laut ini ada hal yang menarik yaitu ada sungai yang mengalir ke dua laut ini yaitu sungai Yordan.
Namun hal yang membedakannya adalah
Pada laut Galilea, aliran air dari sungai yordan mengalir keluar kembali sedangkan pada laut mati aliran sungai Yordan tidak mengalir keluar kembali. Ia hanya menerima dan tidak memberi kembali.

Dari cerita ini kita bisa mempelajari bahwa ketika kita memberi maka kita akan mendatangkan kehidupan dalam hidup kita. Berkat-berkat dari Tuhan akan mengalir dalam hidup kita. Memberi juga merupakan salah satu bentuk nyata ucapan syukur kita pada sang pencipta. Hati yang bersyukur membantu kita berfokus kepada hal-hal yang positif. Memberi yang pertama dan terbaik kepada Tuhan mengungkapkan ucapan syukur kita kepada-Nya dan membantu kita meyakini bahwa Tuhan peduli kepada kita.

Dalam kehidupan nyata, banyak contoh orang-orang sukses yang suka memberi. contohnya Warren Buffet dan Bill Gates. Bill Gates bersama istrinya membangun suatu yayasan amal yang bernama Bill & Melinda Gates Foundation yang bertujuan untuk membantu memperbaiki sistem kesehatan dan mengurangi kemiskinan di seluruh dunia dan memperluas kesempatan pendidikan serta akses ke teknologi informasi di Amerika Serikat. Dari sini ada suatu hal menarik yang bisa kita lihat. Walaupun Bill Gates bersama istrinya banyak memberikan bantuan, kekayaan yang mereka punya bukannya berkurang akan tetapi semakin bertambah. Dari sini kita lihat, berkat Tuhan yang melimpah. Semakin kita memberi kita akan semakin banyak menerima berkah dari Tuhan.
Jadi marilah kita jadikan prinsip ini fundamental paling dasar dalam perencanaan financial yang lebih baik.
:)














Monday, November 25, 2013

Di saat kekhawatiran melanda

Dalam Hidup, kita pasti akan mengalami masa senang dan masa duka.
Hari ini ketika saya mengendarai kendaraan bermotor. Tiba-tiba muncul banyak sekali pemikiran saya tentang masa depan saya. 
Dimulai dari biaya untuk beli rumah, biaya untuk merit, hubungan dengan orang tua.
Mendadak semua itu sangat membuat saya pusing dan khawatir tentang kepastiaan masa depan saya.
Dimana saya takut tidak bisa membahagiakan orang yang saya sayangi. 

Dalam perenungan saya, saya bergumul dengan Sang Pencipta tentang segala hal yang saya alami.
Saya seperti seorang anak yang ngambek dengan orangtuanya. Begitulah hubungan saya dengan Sang Pencipta. Saya menceritakan semua keluh kesah saya dan kekhawatiran yang saya hadapi.
Sepanjang perjalanan saya menuju ke rumah, saya menceritakan semua kegalauan saya pada Bapa.
Setelah bergumul dalam jangka waktu yang panjang, Saya mendengar suatu kata dimana saya harus belajar mensyukuri semua yang telah saya peroleh. Dan saya diingatkan masih banyak orang yang ingin memiliki kehidupan yang saya jalanin. 

Masih banyak orang lain yang belum seberuntung saya. Dan Saya diingatkan setiap berkat yang saya terima dari Sang Pencipta, dimulai dari nafas kehidupan yang baru, keselamatan dalam perjalanan, setiap teman yang baik,  pekerjaan yang baik. Mungkin memang sifat manusia yang tidak pernah puas dan selalu mengharapkan yang terbaik. Dari hal ini saya menyadari dan meminta maaf kepada Sang Pencipta atas semua dosa yang telah saya lakukan. Dan belajar mensyukuri setiap anugerah yang telah saya terima.

Setelah pulang, saya kemudian masuk ke kamar dan berdoa. Saya diingatkan kembali oleh Bapa bahwa Ia selalu memegang janjiNya dan selalu menyertai kita sampai akhir zaman. Kemudian saya teringat kembali segala kebaikan yang telah saya terima dariNya. Dimulai dari saya bisa kuliah pada saat papa saya kena struk dan terancam gagal kuliah. Kemudian saat membayar uang SKS, keluarga saya tidak mampu membiayai uang SKS saya. Akan tetapi Tuhan menyediakan jalan untuk saya sehingga saya bisa membayar uang SKS saya. Dan Tuhan telah membantu keluarga saya keluar dari segala jerat utang. dan masih banyak lagi kebaikan yang telah saya terima.
Saya terdiam dan merenungkan kembali. 
Dan saya teringat janji yang saya dapat dariNya, yaitu masa depan yang cerah. 
Saya memutuskan untuk mempercayai dan memegang teguh janjiNya. 
Karena Ia yang paling tahu yang terbaik untuk kita. 
Dan saya serahkan semua kekhawatiran dan masa depan saya kepadaNya.


Apabila saudara mengalami hal yang sama atau kekhawatiran yang sama.
Marilah kita tundukan kepala kita dan kita berdoa dan jadikan saat-saat teduh ini sebagai waktu intim kita denganNya.
Percayalah bahwa segala RancanganNya indah bagi kita. Dan renungkanlah kembali segala kebaikan yang telah kita terima dari Sang Pencipta. Bersyukurlah dan taruhlah segala beban yang kita punya kepada tanganNya dan percayalah semua akan indah pada waktuNya. Amin.




Sunday, November 24, 2013

Pentingnya perencanaan Financial sejak dini

Pengalaman menyediakan pelajaran penting yang menuntun kita pada kesuksesan.
Pengalaman juga adalah guru yang paling baik.
Saya sangat setuju dengan pandangan di atas. Pengalaman pahit mengajarkan saya betapa pentingnya perencanaan Financial dalam hidup.
Bermula dari pengalaman orangtua saya yang jatuh bangun dalam dunia bisnis, dan sejak jatuh sakitnya Papa saya sehingga bangkrutnya bisnis keluarga saya mengajarkan saya untuk mulai "melek financial".
Saya mulai menyadarinya ketika suatu hari saya sedang berjalan-jalan ke Gramedia dan membeli buku "6 Keranjang 7 Langkah" karangan Lim Tung Ning. Pandangan beliau dalam buku ini menyadarkan saya bahwa banyak tindakan finansial yang saya lakukan dengan buruk. Dan tak terhitung banyak dari tindakan itu yang merugikan saya. Akan tetapi saya tetap bersyukur pada Tuhan, saya disadarkan di usia yang masih terhitung muda dan saya lebih dewasa dibandingkan teman-teman sebaya saya.
Bercermin dari pengalaman saya, saya memutuskan untuk memulai dari nol kembali untuk memperbaiki kehidupan financial saya.

Kesalahan yang saya lakukan

Menggunakan uang investasi reksadana untuk membeli handphone
Ketika awal pertama kali bekerja, saya belajar mengenai reksadana dari teman saya. Reksadana yang saya masuki adalah reksadana Saham, dimana range waktu untuk investasinya adalah jangka panjang. Namun dikarenakan saya tergiur dengan gadget baru, saya menggunakan uang investasi saya untuk membeli handphone tersebut. Dan pada saat itu nilai investasinya sedang turun dikarenakan pertumbuhan ekonomi sedang buruk sehingga saya mengalami kerugian dalam investasi ini. Dan handphone yang saya beli juga tidak bertahan lama selama 1 tahun dikarenakan baterainya bocor dan munculnya handphone yang lebih canggih.

Membeli motor mewah dengan cara kredit.
Banyak orang berpikir mempunyai kendaraan mewah adalah suatu pencapaian. Maka itu mempunyai kendaraan mewah merupakan suatu kebanggaan. Dan itu juga yang terjadi dengan saya. Mendengar pandangan teman saya, saya pun membeli motor yang mewah, padahal kondisi keuangan tidak mendukung.
walaupun saat itu saya memang dalam kondisi membutuhkan motor untuk transportasi saya ke kantor.
Namun dikarenakan menuruti ego saya yang ingin merasakan kepuasan memiliki motor mewah. Namun yang terjadi adalah setelah membeli motor tersebut, saya harus membayar uang cicilan yang besar selama 2 tahun.
Dan saya harus membayar biaya maintenance yang cukup tinggi dan biaya operasional yang tinggi (boros bensin, dan butuh perawatan yang mahal). Dan ketika saya berpikir mau menjual kembali motor saya yang seharga 21 juta (17 juta ditambah cicilan), sekarang harganya sekitar 9 juta.
Rasanya sia-sia sekali membeli motor ini. :(

Berganti-ganti handphone/gadget
Sejak tahun 2007 - 2013, sudah banyak saya berganti gadget saya. seperti cerita saya di atas dimana saya menggunakan uang investasi saya untuk membeli handphone yang saya gunakan tidak sampai 1 tahun.
Setelah saya pikir-pikir kembali, tidak semua fitur handphone tersebut saya butuhkan dan bermanfaat buat saya. Dan saya sudah menghabiskan banyak untuk membeli handphone atau gadget. padahal kalau dipikir-pikir uang tersebut bisa saya gunakan lebih baik seperti untuk tambahan uang untuk DP rumah atau biaya merit.


Terlepas dari semua kesalahan di atas, saya bersyukur bahwa saya masih belum jatuh dalam jeratan utang kartu kredit dan sebagainya. Dimana hal tersebut terjadi pada orang tua saya. Ketika papa saya jatuh sakit stroke, tagihan kartu kredit menunggak dan kami pun dikejar-kejar oleh debt collector. sehingga usaha keluarga kami bangkrut dan kami pun harus menjual rumah kami untuk menutupi utang kami dan membantu membiayai pengobatan papa. Namun saya masih bersyukur kepada Tuhan karena masih diberikan jalan keluar yang terbaik untuk keluarga kami. Dan saat ini kami memulai dari nol lagi dan kami sudah terlepas dari hutang.

Belajar dari semua pengalaman pahit yang saya alami, saya bertekad memperbaiki diri. Dan belajar dari buku 6 Keranjang 7 Langkah karya Pak Lim Tung Ning. saya belajar memahami makna uang dengan benar dan memiliki tujuan keuangan yang jelas dalahm hidup saya.

Saya akan membahas secara singkat perencanaan keuangan saya dalam postingan berikutnya.
Apabila readers tertarik untuk mempelajari perencanaan lebih detail, saya merekomendasikan buku 6 Keranjang 7 Langkah untuk dibaca. karena bukunya menarik dan saya belajar banyak dari Beliau. :)

Outbound with prima in BUMI Kahyangan

Today, i wanna share my outbound with my office in Sukabumi on 2-3 Nov 2013
The place is BUMI Kahyangan.
This is the third times the outbound i go with my office.

I really like this place. feels so natural. And so much games.
it little different with two outbound before.
My Big boss give rent some motivator in this outbound and give so much doorprize in this outbound.
Thanks Bos! :D
You are very generous and nice bos. :)

This is my games team in there. :p
although we lost in game. but we learn something great.
like teamwork, leadership and also friendship and we feel to be one big family. :)




i will never forget what i get in there. :)
is was very interesting outbound.
when the night, we got the session from motivator about our brain powers.
I want to share the session that we got from the motivator. but maybe in another post. :p

and for the tomorrow we got another games.
that is paintball. it was very scary games. a few of my friend get a mark in their body after being shot.
haha. but i love the games.
even though my team lost again in this games. but no hard feeling.
This is great my friend. love the games. If i can play another games again i want to play again.
Once again, i say thanks for my big bos for this outbound.




Btw below is all the picture of prima big family :p

i also want to say thanks for Bumi Khayangan team.
Thanks for the great support. This was the best outbound i had in prima. :p
For you all that read this posting.
if you want to go outbound. i recommend you to BUMI khayangan.
this place was nice and natural. even though the place is not so clean.
but you will feel the nature and the teams in there is great.






Gowagyu Steak

Today i had a dinner with my girlfriend around mangga besar.
and we found steak restaurant.
The name is Gowagyu Steak.



Me and my girlfriend order Fettucini carbonara and Spaghetti Carbonara


 Well this spaghetti and Fettucini  is a delicious.
 You also can try their steak.
 Nyummi. :p
 For the price.. hmm. not cheap. but you must try it. Because the taste is make you will go there again.


Martabak Lovers

Hi Readers,

Today i will posting about martabak.
nyamm. :p
Everybody will love the taste. the chocolate and chesse.. nyummy.

So far as i know, there are 2 places that i recommend to buy martabak.
The first one is on pecenongan. Known as Martabak Bandung.
In this place, you can buy martabak Troblerone and martabak Nuttela..
But don't ask for the price.. Your wallet will cry for the price. But if you like the taste..
This martabak is great. awesome. there are no regret to buy this martabak.




For the second one is martabak near my home.
If your home around jakarta barat (Jelambar) i recommend you to buy one.
The location is on Borobudur street.
Not very expensive but the taste is good. :p
nyummy.





Hope you like the taste.
nyummy

Friday, November 22, 2013

Selection And Repetition Part I

In this part, we will learn how to use selection and repetition command which every programming language will used to execute a statement with certain conditional and repeat a few statement with a short code script.

7.1 test dan operator

test is sh shell utility that used to check information about a file and used to compare both string or numeric.
syntax: test expresion
test work proses is return the status information with 0 value (correct) or 1 (false) where this value status can be read by special variable $.
[elvin@TestBed$]test 7 -gt 3
[elvin@TestBed$]echo $?
0
This statement 7 -gt (greather than) 3 is being evaluated test return 0 for variable status $. 
This mean this statement is true.
if we compare with below expresion
[elvin@TestBed$]test 3 -lt 1
[elvin@TestBed$]echo $?
1
 this status value is 1, which mean false statement
if you see the symbol -gt and -lt, this want mean operator.
simple operator is special character that do operation for a few operand, example 2+3.
"+" is an operator. 2 and 3 is an operand. 
for test example, the operator is -lt and -gt, and the number is on left and the operand is on the right. 
Below is the operator that bash can be used:
OperatorInformation
bil1 -eq bil2return true if bil1 is same as bil2
bil1 -ne bil2return true if bil1 is not same as bil2
bil1 -lt bil2return true if bil1 is less than bil2
bil1 -le bil2return true if bil1 is less than enough bil2
bil1 -gt bil2return true if bil1 is greater than bil2
bil1 -ge bil2return true if bil1 is greater than enough bil2

7.1.2. Operasi string

OperatorInformation
-z STRINGreturn true if STRING length is zero
STRING1 == STRING2return true if STRING1 is same as STRING2

7.1.3 Operator file

OperatorInformation
-f FILEreturn true if FILE is exist and is a normal file
-d FILEreturn true is FILE is exist and is a directory

7.1.4 Operator logic

ekspr1 -o ekspr2return true is one of the expression is true  (or,||)
ekspr1 -a ekspr2return true is expression 1 and expression 2 true(and,&&)
! ekspresireturn true if the expression is false (not!)

Introduction to perl scripting

Perl is one of the programming language that most being used by system administrator to manage a server.
Perl is also most being used by hacker and cracker to explore a system.

Perl's History

Perl is Practical Extraction and Report Language. which was created by Larry Wall on 1987.
Larry create perl to make the report process is more easy.  But this program was well developed and become a programming language that most being used by system administrator, web developer, graphic programmer, network programmer, etc.

Installation Perl

In GNU/Linux Operating System, by default perl already being installed. 
and for Windows Operating System, we can use application program named Padre and strawberry Perl.

We will skip for the installation since we will use Linux for the testing.
For the first example we will create a program "Hello, World".
We can use vi editor to create the file. 
for the extension file we must give a named with .pl in back of file example abc.pl, test.pl, etc.

below is the example script
[elvin@TestBed$] vi hello.pl

#!/usr/bin/perl -w

print "Hello, World\n";
After we change the permission to execute the file
below is the result:

[elvin@TestBed$]./hello.pl
Hello, World

or we can use perl command

[elvin@TestBed$]perl hello.pl
Hello, World

Simple I/O with bash scripting

I/O is a based of computer work because this capacity make computer so power.
I/O is a device that handle input and output, both for keyboard, floppy, monitor screen, etc. 
beside echo, we can use printf command to print out with output standard, in screen or in file with specific format.

below this example:
#!/bin/bash
#pr1

url="elvin.enderson.blogspot.com";
number=32;

printf "Hi, use printf ala C\n\t\a in bash\n";
printf "My url %s\n %d decimal = %o octal\n" $url $number $number;
printf "%d decimal in float = %.2f\n" $number $number

and below is the result

[elvin@Testbed$]./pr1
Hi, use printf ala C
    in bash
My url  elvin.enderson.blogspot.com
32 decimal = 40 octal
32 decimal in float = 32.00

below it the table for the format control

Format controlinformation
%ddata integer format
%ooctal
%ffloat atau decimal
%xHexadecimal

Input with read

after echo and printf for output process, now we will use command read.
this command very good to read or accept input from standard input

below is the example

#!/bin/bash
#rd1

echo -n "Your name :"
read name;

echo    "Hi $name,  How are you?";
echo    "message and reply :";
read 
echo    "said $name, $REPLY";

below is the result

[elvin@Testbed$]./rd1
Your name : elvin
Hi elvin, How are you?
message and reply :
i'm fine. thanks
said elvin, i'm fine. thanks





Buku rekomendasi untuk perencanaan keuangan

Hi Readers,

Beberapa bulan yang lalu ketika jalan-jalan di gramed (maklum saya suka nongkrong baca buku di gramed)
As usual ketika melihat-lihat buku, saya tertarik ke bagian investasi.
Kemudian saya melihat satu buku yang menarik saya dan kemudian saya coba membuka buku tersebut.
alhasil beli bukunya deh.
Setelah dibaca-baca, ga nyesel belinya. dan bener-bener rekomen banget.
di bawah ini adalah bukunya


Judul Bukunya  : 6 Keranjang 7 Langkah
Pengarang        : Lim Tung Ning

Dari buku ini saya banyak belajar bagaimana cara mengelola keuangan dan merencanakan financial freedom untuk masa depan saya dan keluarga saya. Selain itu saya belajar bagaimana mengatasi utang yang mengurangi kekayaan keluarga saya dan bagaimana cara memproteksi harta saya.
So buat teman-teman yang ingin memulai merencanakan keuangan atau ingin memperbaiki financial keluarga.
saya merekomendasikan buku ini.
Pokoknya jangan dilewatin buku yang satu ini. :)



Operator Mathematics in bash scripting

When we talking about programming, we can't off with operator mathematics.
In Bash scripting, there are 3 ways to use operator mathematics.

  1. let
  2. expr
  3. substitution
let's us try to combine the 3 ways that we know in one script


#!/bin/bash
#math1

a=10
b=5
#use let
let add=$a+$b
let min=$a-$b
let multiple=$a*$b

#memakai expr
divide=`expr $a / $b`

#use substitution command $((expresion))
mod =$(($a%$b))  #modulus

echo "$a+$b=$add"
echo "$a-$b=$min"
echo "$a*$b=$multiple"
echo "$a/$b=$divide"
echo "$a%$b=$mod"


Below is the result

[elvin@Testbed$]./mat1
10+5=15
10-5=5
10*5=50
10/5=2
10%5=0

for expr function it is also useful for string
example
[elvin@Testbed$]mystr="linux"
[elvin@Testbed$]expr length $mystr
5


Positional Parameter

In previous post, we already learn how to use variable in bash scripting.
In this article, i will share the use in shell scripting.

Positional Parameter

Positional parameter is a variabel that being used by shell to contain argumen that given to shell.
below is the example for the script:

#!/bin/bash
#argumen1

echo $1 is one of popular $2 populer in $3

if we input word beside the script
example

[elvin@Testbed$]./argumen1 bash shell linux
bash is one of popular shell in linux

In this example, we can take conclution that
word bash will be save in positional 1 ($1)
word shell will be save in positional 2 ($2)
word linux will be save in positional 3 ($3)

Below is other example for positional parameter

#!/bin/bash
#argumen2

clear
echo "Your name script   : $0";
echo "How many Argumen   : $#";
echo "The Argumen is     : $*";

and the result

[elvin@Testbed$]./argumen 1 2 3 empat
Your name script  : ./argumen
How many Argumen  : 4
The Argumen is    : 1 2 3 empat




Thursday, November 21, 2013

How to use variable in bash script

Today we will learn more about variable in shell.
To process our data/information, data must be kept in computers RAM memory. RAM memory is divided into small locations, and each location had unique number called memory location/address, which is used to hold our data. Programmer can give a unique name to this memory location/address called memory variable or variable (Its a named storage location that may take different values, but only one at a time).
In Linux (Shell), there are two types of variable:

  1. System variables - Created and maintained by Linux itself. This type of variable defined in CAPITAL LETTERS
  2. User defined variables (UDV) - Created and maintained by user. This type of variable defined in lower letters. 

You can see system variables by giving command like $ set, some of the important System variables are:

System Variable
Meaning
BASH=/bin/bashOur shell name
BASH_VERSION=1.14.7(1)Our shell version name
COLUMNS=80No. of columns for our screen
HOME=/home/vivekOur home directory
LINES=25No. of columns for our screen
LOGNAME=studentsstudents Our logging name
OSTYPE=LinuxOur Os type
PATH=/usr/bin:/sbin:/bin:/usr/sbinOur path settings
PS1=[\u@\h \W]\$Our prompt settings
PWD=/home/students/CommonOur current working directory
SHELL=/bin/bashOur shell name
USERNAME=vivekUser name who is currently login to this PC

How to define User defined variables (UDV)

To define UDV use following syntax
Syntax: 
variable name=value
'value' is assigned to given 'variable name' and Value must be on right side = sign.

Example:$ no=10# this is ok
$ 10=no# Error, NOT Ok, Value must be on right side of = sign.
To define variable called 'vech' having value Bus
$ vech=Bus
To define variable called n having value 10
$ n=10


Rules for Naming variable name (Both UDV and System Variable)

(1) Variable name must begin with Alphanumeric character or underscore character (_), followed by one or more Alphanumeric character. For e.g. Valid shell variable are as follows
HOME
SYSTEM_VERSION
vech
no

(2) Don't put spaces on either side of the equal sign when assigning value to variable. For e.g. In following variable declaration there will be no error
$ no=10
But there will be problem for any of the following variable declaration:
$ no =10
$ no= 10
$ no = 10

(3) Variables are case-sensitive, just like filename in Linux. For e.g.
$ no=10
$ No=11
$ NO=20
$ nO=2

Above all are different variable name, so to print value 20 we have to use $ echo $NO and not any of the following
$ echo $no # will print 10 but not 20
$ echo $No# will print 11 but not 20
$ echo $nO# will print 2 but not 20
(4) You can define NULL variable as follows (NULL variable is variable which has no value at the time of definition) For e.g.
$ vech=
$ vech=""
Try to print it's value by issuing following command
$ echo $vech
Nothing will be shown because variable has no value i.e. NULL variable.
(5) Do not use ?,* etc, to name your variable names.

How to print or access value of UDV (User defined variables)

To print or access UDV use following syntax
Syntax: 
$variablename
Define variable vech and n as follows:
$ vech=Bus
$ n=10

To print contains of variable 'vech' type
$ echo $vech
It will print 'Bus',To print contains of variable 'n' type command as follows
$ echo $n
Caution: Do not try $ echo vech, as it will print vech instead its value 'Bus' and $ echo n, as it will print n instead its value '10', You must use $ followed by variable name.



Link State Routing Protocol (LSRP)

In previous section, we already learn about DVRP.
Today we will learn about LSRP.
What is LSRP?
LSRP is a routing protocol that contain a full topology of network.
LSRP is using Djikstra algorithm or commonly called by SPF (Shortest Path First) Algorithm.
Now we will learn how the process of Link State:
1. Every router will learn about it’s directly connected network
2. Every router will send “hello packet” to neighbor / directly connected network.
3. Every router make LSP (Link State Packet) that contain information (cost) every directly connected network.
4. Every roter send LSP to all neighbor/flooding , after that being saved in a database.
5. Every router use it’s database to create topology and count the best path to every destination network.
The advantages using LSRP is:
- Know all topology
- Fast Convergence
- LSP send if there are any changes in topology
- Hierarchial Design (multi area).
the example of LSRP is OSPF.
here is the example for OSPF

IP Address (Introduction to Subnetting)

Before we go to learn about subnetting.
First we need to know about IP Address. IP address is a numeric identifier assigned to each machine on
an IP network. It designates the specific location of a device on the network.
An IP address consists of 32 bits of information. These bits are divided into four sections, referred to as octets or bytes, each containing 1 byte (8bits). You can depict an IP address using one of three methods:
+) Dotted-decimal, as in 172.16.30.56
+) Binary, as in 10101100.00010000.00011110.00111000
+) Hexadecimal, as in AC.10.1E.38
All these examples truly represent the same IP address. Hexadecimal isn’t used as often as dotted-decimal or binary when IP addressing is discussed, but you still might find an IP address stored in hexadecimal in some programs. The Windows Registry is a good example of a program that stores a machine’s IP address in hex.
Network Addressing
The network address (which can also be called the network number) uniquely identifies each network. Every machine on the same network shares that network address as part of its IP address. In the IP address 172.16.30.56, for example, 172.16 is the network address.
The node address is assigned to, and uniquely identifies, each machine on a network. This part of the address must be unique because it identifies a particular machine—an individual—as opposed to a network, which is a group. This number can also be referred to as a host address.
In the sample IP address 172.16.30.56, the 30.56 is the node address.
IP address is divide by class. Below is the picture of IP Address Classes.
Network Address Range: Class A
The designers of the IP address scheme said that the first bit of the first byte in a Class A network address must always be off, or 0. This means a
Class A address must be between 0 and 127 in the first byte, inclusive.
Consider the following network address:
0xxxxxxx
If we turn the other 7 bits all off and then turn them all on, we’ll find the Class A range of network addresses:
00000000 = 0
01111111 = 127
So, a Class A network is defined in the first octet between 0 and 127, and it can’t be less or more. (Yes, I know 0 and 127 are not valid in a Class
A network. I’ll talk about reserved addresses in a minute.)
Network Address Range: Class B
In a Class B network, the RFCs state that the first bit of the first byte must always be turned on but the second bit must always be turned off. If you
turn the other 6 bits all off and then all on, you will find the range for a Class B network:
10000000 = 128
10111111 = 191
As you can see, a Class B network is defined when the first byte is configured from 128 to 191.
Network Address Range: Class C
For Class C networks, the RFCs define the first 2 bits of the first octet as always turned on, but the third bit can never be on. Following the same
process as the previous classes, convert from binary to decimal to find the range. Here’s the range for a Class C network:
11000000 = 192
11011111 = 223
So, if you see an IP address that starts at 192 and goes to 223, you’ll know it is a Class C IP address.
Network Address Ranges: Classes D and E
The addresses between 224 to 255 are reserved for Class D and E networks. Class D (224–239) is used for multicast addresses and Class E
(240–255) for scientific purposes, but I’m not going into these types of addresses in this book (and you don’t need to know them).
Network Addresses: Special Purpose
Some IP addresses are reserved for special purposes, so network administrators can’t ever assign these addresses to nodes. Table 3-4 lists the
members of this exclusive little club and the reasons why they’re included in it.
Class A Addresses
In a Class A network address, the first byte is assigned to the network address and the three remaining bytes are used for the node addresses.
The Class A format is as follows:
network.node.node.node
For example, in the IP address 49.22.102.70, the 49 is the network address and 22.102.70 is the node address. Every machine on this particular
network would have the distinctive network address of 49.
Class A Valid Host IDs
Here’s an example of how to figure out the valid host IDs in a Class A network address:
All host bits off is the network address: 10.0.0.0.
All host bits on is the broadcast address: 10.255.255.255.
The valid hosts are the numbers in between the network address and the broadcast address: 10.0.0.1 through 10.255.255.254. Notice that 0s
and 255s can be valid host IDs. All you need to remember when trying to find valid host addresses is that the host bits can’t all be turned off or all be
on at the same time.
Class B Addresses
In a Class B network address, the first 2 bytes are assigned to the network address and the remaining 2 bytes are used for node addresses. The format is as follows:
network.network.node.node
For example, in the IP address 172.16.30.56, the network address is 172.16 and the node address is 30.56.
Class B Valid Host IDs
Here’s an example of how to find the valid hosts in a Class B network:
All host bits turned off is the network address: 172.16.0.0.
All host bits turned on is the broadcast address: 172.16.255.255.
The valid hosts would be the numbers in between the network address and the broadcast address: 172.16.0.1 through 172.16.255.254.
Class C Addresses
The first 3 bytes of a Class C network address are dedicated to the network portion of the address, with only 1 measly byte remaining for the node
address. Here’s the format:
network.network.network.node
Using the example IP address 192.168.100.102, the network address is 192.168.100 and the node address is 102.
Class C Valid Host IDs
Here’s an example of how to find a valid host ID in a Class C network:
All host bits turned off is the network ID: 192.168.100.0.
All host bits turned on is the broadcast address: 192.168.100.255.
The valid hosts would be the numbers in between the network address and the broadcast address: 192.168.100.1 through 192.168.100.254.
Private IP Address
The people who created the IP addressing scheme also created what we call private IP addresses. These addresses can be used on a private network, but they’re not routable through the Internet. This is designed for the purpose of creating a measure of well-needed security, but it also conveniently saves valuable IP address space.
If every host on every network had to have real routable IP addresses, we would have run out of IP addresses to hand out years ago. But by using private IP addresses, ISPs, corporations, and home users only need a relatively tiny group of bona fide IP addresses to connect their networks to the Internet. This is economical because they can use private IP addresses on their inside networks and get along just fine.
To accomplish this task, the ISP and the corporation—the end user, no matter who they are—need to use something called Network Address Translation (NAT), which basically takes a private IP address and converts it for use on the Internet. (NAT is covered in Chapter 13, “Network Address Translation.”) Many people can use the same real IP address to transmit out onto the Internet. Doing things this way saves megatons ofaddress space—good for us all!
Source : CCNA Cisco Certified Network Associate S – Lammle_ Todd

Step By Step Cisco Router Configuration (Introduction II)

Ok. Before we start configure the router.
First of all, I want to explain about router.
What is router?
Router is a computer.
Router had a working process like a computer but a difference is Router only work from Layer 1 s/d Layer 3.
A computer work on Layer 7.
Well First I will describe about Router Component.
-CPU: Central Process Unit -> to do the process which mean the main core like brain in human body.
-ROM: Read Only Memory -> to save bootstrap program and scaled down IOS version, performing POST (same function with BIOS in PC)
-RAM: Random Access Memory -> for temporary memory
-NV-RAM -> to save configuration permanently
-Flash: -> to save IOS (same function with Harddisk in PC)
Now i will explain how the process in Router boot-up:
- Router will performing POST (Power On Self Test) to ensure that the hardware is on or not.
- After that load bootstrap program (Program that running the program which more bigger, load program into RAM)
- Locate and loading IOS
when locate, it will search in Flash. If in flash didn’t contain IOS, it will search in TFTP Server. If in TFTP Server didn’t have, it will scaled down IOS version.
- Locate and loading startup Configuration File.
when locate, it will search in NV-RAM. If in NV-RAM didn’t contain Configuration File, it will search in TFTP Server. If in TFTP server didn’t have, it will prompt Setup Mode.
Principe Routing Table
1.Every router had to make a self decision based on Routing table information
2.Routing table information in every router not necessarily same
3.Information about some way is n0t consist information about return path
You also must know about metric.
Metric is unit measurement for the software.
EIGRP using Bandwith for the metric. RIP using Hop for the metric.
Next we will start to know what is routing static and the example case for routing static.
Hope u enjoy it.

Step By Step Cisco Router Configuration (Introduction)

Before we start to configure router, there are a few things that you must know.
Cisco IOS software provides two levels of access to commands: user and privileged for security purpose.
The unprivileged user mode is called user EXEC mode. The privileged mode is called privileged EXEC mode and requires a password.
Below is table that describes some of the most commonly used modes, how to enter modes, and the resulting prompts.
The prompt helps you identify which mode you are in and , which command are available to you

How to use Help
In any command mode, you can get a list of available commands by entering a question mark (?).
To know a list of commands that begin with a particular character sequence, u can use question mark in the end
example
Router#co?
configure connect copy
To list keywords or arguments, enter a question mark in place of keyword or argument. Include a space before the question mark.
example
Router# configure ?
memory Configure from NVmemory
network Configure from a TFTP network host
terminal Configure from the terminal
You can also commands and keywords by entering just enough character to make the command unique from other commands.
For example
u can type show command with sh
en to enable
We will explain more in other subject. :D
Hope this blog can help u understand more.

Physical Layer

Now we would explain the last of OSI layer, the first/lowest of OSI layer.
Physical layer consists of the basic networking hardware transmission technologies of a network.
Physical layer is a fundamental layer underlying the logical data structures of the higher level functions in a network.
This layer is the most complex layer in the OSI architecture.
In this layer, it defines the means of transmitting raw bits rather than logical data packets over a physical link connecting network nodes. the bit stream may be grouped into code words or symbols and converted to physical signal that is transmitted over a hardware transmission medium.
for example, data transfer in modem (signal to digital).
The example device that work in this device is Hub, repeater, network interface card.
The main function of this layer :
1. Definition of Hardware Specifications: The details of operation of cables, connectors, wireless radio transceivers, network interface cards and other hardware devices are generally a function of the physical layer
2. Encoding and Signaling: The physical layer is responsible for various encoding and signaling functions that transform the data from bits that reside within a computer or other device into signals that can be sent over the network.
3. Data Transmission and Reception: After encoding the data appropriately, the physical layer actually transmits the data, and of course, receives it. Note that this applies equally to wired and wireless networks, even if there is no tangible cable in a wireless network!
4. Topology and Physical Network Design: The physical layer is also considered the domain of many hardware-related network design issues, such as LAN and WAN topology.

Data Link Layer

Right now, we are going to talk about Data Link Layer.
Data link layer had a function to make sure that message sent to correct device and translate message from network layer to bits form to transmitted by Physical layer.
In this layer, message is in form data frame with additional header which contain source address and destination hardware.
In device layer 3 (router), device worked to choose the best way to reach network destination, but the device didn’t care where the host is located. In Device layer 2 had responsibility to identified every device in network.
When host send package to another host, data link layer will frame the package with information data link control include hardware address, but if this package go through a router, this information will be left, router just receive the original package.
In Data link layer had 2 sublayers which is MAC and LLC.
*
Media Access Control (MAC) also know as 802.3.
this define how the package been replace by media. Physical address and logical topology being defined in here.
Logical topology is signal path which go trough a physical topology.
MAC may refer to the sublayer that determines who is allowed to access the media at any one time (usually CSMA/CD). Other times it refers to a frame structure with MAC addresses inside.
CSMA/CD (Carrier Sense Multiple Access with Collision Detection) is a access method that trace every possibility collision will happen. If a computer want to send data and detect that data which will be send is already in network, it will wait for a few times to try again send the data, so the collision can be avoid.
If in the checking step found another data transmission and being collision with the data which being send, the node must send again the request in a few minutes in random time.
There are generally two forms of media access control: distributed and centralized.
To make you more easy to understand,
for example in a conversation, If two people speak at the same time, they will back off and begin a long and elaborate game of saying “no, you first”.
The MAC determines where one frame of data ends and the next one starts – frame synchronization
There four means of frame synchronization.
- time based
- character counting
- byte stuffing
- bit stuffing.
*
The second of is:
Logical link control (LLC) also known as 802.2.
This sublayer had responsible to identify network layer protokol and then encapsulate it. Header LLC told to data link layer what should be done for package when frame is received.
For example:
a host that received frame and will saw header LLC to understand the packet destination in IP protocol on network layer. LLC is also give flow control and sequence the control bit.
A example device that work in Data link Layer is Switch and Bridges

Network Layer

Right now we discuss about Network Layer.
First of all, what is Network Layers? what is the main function of this layer?
The Network layer(usually called layer 3) manages devices addressing (logical addressing), tracks the location of devices on the network, and determines the best way to move data (routing data).
The devices that working in this layer of course is router. :)
Below is the flow for networking:
First, when a packet is received on router interface, the Destination IP address is checked. If the packet isn’t destined for that specific router, it will look up the destination network address in routing table.
Once the router chooses an exit interface, the packet will be sent to that interface to be framed and sent out on the local network. If the router can’t find an entry for the packet’s destination network in the routing table, the router drops the packet.
Two types of packets are used at the Network Layer: data and route updates.
Data packets
Used to transport user data through the internetwork. Protocol used to support data traffic are called routed protocols.
example: IP and IPX.
Route update packets
Used to update neighboring routers about the networks connected to all routers within the internetwork. Protocol that send route update packets are called routing protocols.
example: RIP,EIGRP,and OSPF.
The Routing table used in a router includes the following information:
Network address
A route must maintain a routing table for individual routing protocols because each routing protocol keeps track of a network with different addressing scheme.
Interface
The exit interface a packet will take when destined for a specific network
Metric
The distance to the remote network.Different routing protocols use different ways of computing this distance.
hop count
The number of routers a packet passes through en route to a remote network.
router break up broadcast domains and collision domains. (broadcast aren’t forwarded through a router).
To make u more understand more about broadcast domain and collision domain
below is the video of explanation broadcast and collision domains.

To make u more easier, i will review the point that you should remember in this section:
1. Routers, by default, will not forward any broadcast, multicast packets
2. Routers use the logical address in a Network layer header to determine the next hop router to forward the packet to
3. Routers can use access lists, created by an administrator, to control security on the types of packets that are allowed to enter or exit an interface
4. Routers can provide layer-2 bridging functions if needed and can simultaneously route through the same interface.
5. layer 3 devices provide connections between virtual LANs (VLANs).
6. Routers can provide quality of service (QoS) for specific types of network traffic.

Transport Layer

Before entering another layer in Lower layer, first of all we must know about transport layer.
What is transport layer? What is the function for this layer?
This layer segment and reassembles data into a data stream.
The example device /fitur for this layer is firewall.
There are 2 protocol in this layer that you must know.
The protocol is TCP and UDP.
TCP = transmission control protocol.
UDP = user datagram protocol
TCP is usually used by FTP. UDP is used by voice.
The Difference between TCP and UDP:
TCP
—-
connection oriented
Flow Control
3 way handshake
Overhead -> The sent data is more bigger than total size because it contain header information
Reliable
Header 20 byte
UDP

Connectionless
Header 8 byte
Fast data delivery
Unreliable
The Transport Layer is responsible for providing mechanisms for multiplexing upper-layer applications, establishing sessions, and tearing down virtual circuit.
It also hides detail of any network-dependent information from the higher layers by providing transparent data transfer.
Multiplexing is a technic that sending more than 1 information using 1 channel.
The purDatagrampose of multiplexing is to save the total of physical channel like cable, transceiver, optic cable,etc.
MTU (Maximum Transmission Unit) is a maximum data limitation that can being send by a one frame in Network Interface Layer in TCP/IP. Layer Network Interface is not desain to accept or sending frame that contain more than MTU that we config.a one Datagram IP is a must lower or same size with MTU or it can’t be encapsulation for sending.(Comer, 2001)