-1

What does the # mean in a for loop in bash? Unfortunately, I don't get information googling about it.

For example:

for n in 2 3 4 # 5 6 7 8 9 10
do
...
done

?

user1237300
  • 231
  • 2
  • 11

1 Answers1

0

That # simple is a 1-line comment, like the // in C++ and Java. This is a comment example:

int i = 0; // Declare an integer to 0.

And then, in bash

# Test script
for n in 2 3 4 # 5 6 7 8 9 10
do
echo $n # But don't do this text to the right of the #
done
robotsfoundme
  • 418
  • 4
  • 18