Skip to content

Instantly share code, notes, and snippets.

@ismailakbudak
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ismailakbudak/6c0455ec43e493cace6a to your computer and use it in GitHub Desktop.
Save ismailakbudak/6c0455ec43e493cace6a to your computer and use it in GitHub Desktop.
#!/bin/bash
# Yorum satırı
# İlk satırdaki komut ise yorum değildir.
# Bu satırın anlamı bu scripti bash shell de çalıştır.
# Terminali temizle komutu
clear
# Teminale Hello world yazar
echo "Hello world"
# Şuanda ki kullanıcıyı terminale yazar
echo $USER
# Değişkenlerin satır içinde kullanımına bir örnek
echo "Hi, $USER!"
# Kullanıcıdan değer okuma örneği
echo "Value :"
read year
echo "You entered value: $year"
# Girilen değerin integer mı string mi olduğunu öğrenme
if [ $year -eq $year 2>/dev/null ]
then
echo "$year is an integer"
else
echo "$year is not an integer"
fi
# $( ls / ) Root dizindeki dosyaları terminale yazar
# $( ls /home/ ) şeklinde de istenilen dizindeki dosyalar listelenebilir
for i in $( ls / ); do
echo item: $i
done
# Bash script ile for döngüsü kullanıcının girdiği parametreler terminale yazılır
COUNT=0
for i in $@ ; do
echo $i
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment