I am trying to fetch the for loop limit from the user. When I am passing that variable it's not iterating across it
for num in {1..$totalNodes}
But when I am giving a hardcoded value
for num in {1..10}
it runs fine. Can anyone please help.
Here is my code:
#!/bin/bash
#!/bin/sh
read -p "Enter the total no of nodes : " totalNodes
read -p "Enter the no of Master nodes : " masterNodes
echo $totalNodes
echo $masterNodes
for num in {1..5}
do
echo "$num"
read -p "Enter the Node $num IP : " node[$num]
done
echo $node