catatan bin bash

/bin/bash(.sh) sedikit berbeda dengan perl (.pl), tapi entah kenapa gw lebih suka bin bash. Terasa lebih ringkas.

diawali dengan

#!/bin/bash

komentar dengan

# this is a comment

assignment variable dan penggunaannya

test="/home/guest/testfolder"
mkdir $test

penggunaan if

if kondisi
then
  # something
elif
then
  # something
fi

penggunaan while

while kondisi
do
  # something
done

kondisi

[ $tes -lt 10 ]
# -lt less than
# -le less equal than
# -gt greater than
# -ge greater equal than

baca file line per line

while read -r line
do
   echo $line
done < file.txt

later…

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s