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
  • 47
  • 78
Bm_bm
  • 1
  • 2

1 Answers1

0

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

bash -x potenz2.sh
Barmar
  • 741,623
  • 53
  • 500
  • 612
  • 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