Ana Sayfa / Linux / Bash Script / Hello World in “Debug” mode / Hata Ayıklama Modunda Merhaba Dünya

Hello World in “Debug” mode / Hata Ayıklama Modunda Merhaba Dünya

$ cat hello.sh
#!/bin/bash
echo "Hello World"
$ bash -x hello.sh
+ echo Hello World
Hello World

The -x argument enables you to walk through each line in the script. One good example is here:

$ cat hello.sh
#!/bin/bash
echo "Hello World\n"
adding_string_to_number="s"
v=$(expr 5 + $adding_string_to_number)

$ ./hello.sh
Hello World

expr: non-integer argument

The above prompted error is not enough to trace the script; however, using the following way gives you a better
sense where to look for the error in the script.

$ bash -x hello.sh
+ echo Hello World\n
Hello World

+ adding_string_to_number=s
+ expr 5 + s
expr: non-integer argument
+ v=

Bunada Göz Atın

PHP Types

Type Comparison There are two types of comparison: loose comparison with == and strict comparison …

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir