0

I am pretty new here and learning programming. I wonder if there is a way to see the action of a shell script as it is executed? For example, I want to see how the values are inserted into the variables in this script.

#!/bin/bash
# Script: potenz2.sh (powers of two with a while loop)
i=0
j=1
while (( i < 12 ))
do
        j=$((j * 2))
        echo -n "$j"
        i=$((i+1))
done
echo ""
Braiam
  • 1
  • 11
  • 50
  • 74
Bm_bm
  • 1
  • 1

1 Answers1

0

Put set -x at the beginning of the script, or run it with that option

bash -x potenz2.sh
Barmar
  • 669,327
  • 51
  • 454
  • 560
  • Thank you very much Barmar. I didn't know it could be so easy. There are so many things to learn. – Bm_bm Jul 31 '21 at 18:47