Ở đây có nói mình có thể debug từng dòng trên shell, nhưng sao mình làm nó ko ra lệnh!
Code:
#!/bin/bash -xv
Once you found the buggy part of your script, you can add echo statements before each command of which you are unsure, so that you will see exactly where and why things don't work. In the example commented-script1.sh script, it could be done like this, still assuming that the displaying of users gives us problems:
echo "debug message: now attempting to start w command"; w
Đây là code mình thử viết:
Code:
#!/bin/bash -xv
clear
echo "The script start now"
echo "Hi $USER"
w
echo "I'm setting 2 variable now"
COLOUR="black"
VALUE="9"
colour = $COLOUR
value = $VALUE
echo "value"
echo "colour"
echo "Exit"
Mình muốn hiện biến colour bằng lệnh:
echo "xxx";colour nhưng sao ko thấy hiện "black"?