Ana Sayfa / Linux / Bash Script / Importance of Quoting in Strings / Dizelerde Alıntı Yapmanın Önemi

Importance of Quoting in Strings / Dizelerde Alıntı Yapmanın Önemi

Quoting is important for string expansion in bash. With these, you can control how the bash parses and expands
your strings.

There are two types of quoting:

  • Weak: uses double quotes: “
  • Strong: uses single quotes: ‘

If you want to bash to expand your argument, you can use Weak Quoting:

#!/usr/bin/env bash
world="World"
echo "Hello $world"
#> Hello World

If you don’t want to bash to expand your argument, you can use Strong Quoting:

#!/usr/bin/env bash
world="World"
echo 'Hello $world'
#> Hello $world

You can also use escape to prevent expansion:

#!/usr/bin/env bash
world="World"
echo "Hello \$world"
#> Hello $world

For more detailed information other than beginner details, you can continue to read it here.

Bunada Göz Atın

Python Bitwise Operators

Bitwise operations alter binary strings at the bit level. These operations are incredibly basic and …

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir