published on 16.11.2019

Değişkenler, herhangi bir dilde çalışırken ilk öğretilen konulardan biridir. Bash’e giriş yaparken, değişkenlerle başlayacağım. Nasıl değişken tanımlanır? Sık kullanılan built-in değişkenler hangileridir?

Assign Variables

Bash’de çalışırken aşağıdaki gibi değişkenler tanımlanabilir.

str="Hello, there!"
echo $str
> Hello, there!

Değişkenleri bazı (attribute) özelliklerle tanımlamak da mümkün.

declare -i d=123                                    # Integer
declare -r e="Haha, I'm read only."                 # Read-Only
declare -l b="This text is gonna be lowercase."     # Lower-Case
declare -u c ="This text is gonna be UPPERCASE"     # Upper-Case

Built-In Variables

Aşağıda sık kullanılan bazı built-in variablelar listelenmiştir. Fazlası için The Linux Documentation Project

echo $HOSTNAME
echo $MACHTYPE
echo $HOME
echo $PWD
echo $SECONDS           # Returns the number of seconds the Bash session has run
                        # If used in a script, it'll start counting from when the script started.
echo $0                 # Returns the name of the script.
echo $BASH              # Returns the path to the BASH binary. /bin/bash
echo $BASHPID           # Process ID of the current instance of Bash.
echo $BASH_VERSION
echo $PATH              # Path to binaries. Usually /usr/bin/, /usr/X11R6/bin/, /usr/local/bin, etc.
You are reading the 1st of 10 episodes in Bash.
Published on 16.11.2019 by Mert Bakır with commit db8d56a.
bash
#bash #linux
Next episode:
Bash: Arithmetic Operations
published on 16.11.2019

val=a + a - a * a / a ** a % a > 27 let "a = 3 ** 3" echo $a > 27 Double Parentheses let, ile çalışabileceğimiz gibi çift parantez kullanarak da bash’e aritmatik operasyon yapılmasını gerektiğini anlatabiliriz.

published on 16.11.2019

Bu bölümde, bash ile string manipulasyonu ile ilgili temel konuları kısa örneklerle açıklayacağım. Concatenation, append, length, substring ve sık kullanılan cut komutu… […] String concatenation, için stringleri peş peşe yazmak yeterlidir. […] a="Hello" b="There" …

published on 17.11.2019

Bu yazıda, bash scriptlerindeki dizi mantığına temel bir giriş yapacağız. Bir boyutlu indexed arrayleri ve associative arrayleri (key, value pairs) ele alacağız. Başlayalım… Bash üzerinde boş bir dizi oluşturmak için aşağıdaki syntax kullanılabilir. […] a=() # a is an empty array …

published on 10.07.2022

Previously, I’ve published a blog post about deploying static content on heroku with basic authentication. The main purpose was to get basic auth for a freely hosted static website. In that post, we hosted the source code on GitLab and configured a CI/CD pipeline to render the static content …

published on 28.05.2022

Each git commit has a field called Author which consists ‘user.name’ and ‘user.email’. We usually set these variables once, after installing git, with git config --global so that each repo gets the variables from the global definition. We can also set them locally for a …

published on 25.05.2022

In this post, I’ll first walk through hosting static content with basic authentication. Then, we’ll look into deploying to Heroku using GitLab Pipelines, more specifically deploying a certain sub-directory within the project instead of pushing the whole project. Also, I’ll share …

published on 17.04.2022
edited on 15.07.2022

Önceki bölümde, markdown formatını LaTeX formatına dönüştürmek için kullanılan Pandoc yazılımından bahsetmiştik. Şimdi konuyu bir adım daha ileri taşıyıp ve bookdown’a geçiyoruz. Bookdown; Rmarkdown kullanarak teknik dökümanlar, kitaplar yazabilmemizi sağlayan, Yihui Xie tarafından yazılmış …

published on 10.04.2022

I’ve been using WSL-2 on Windows for over a year. It’s very useful because some Python packages are just a headache to install on Windows. Also, docker. It’s just better on Linux. Yet, WSL-2 can also be problematic. I remember trying a dual-boot setup when things just went way too …

published on 03.03.2022

In this post, I’ll share how to install geopandas and some other gis related packages on Windows. If you are on Mac or Linux you can probably just pip install those without any issue. I usually had to do a google search every time I wanted to install these packages on Windows environment. Of …