Skip to main content
edited tags
Link
ilkkachu
  • 148.1k
  • 16
  • 268
  • 441
deleted 1 character in body
Source Link
user147505
user147505

I have a bash script which contains awscli as well. I am trying to print a variable which is created in a for loop. The variable that I am trying to print contains $ sign because of for loop. I couldn't print the value. Below I amsam sharing the script. The output of this script is only numbers which is generated in the for loop. I want to print the value which is generated in the command.

#!/bin/bash

declare -i counter=11
declare -i counter2=14

for i in {1..2}
do
    declare v1$i=$(aws iam get-group --group-name VideoEditors | awk -v counter1=$counter 'NR==counter1' | awk -F\" '{print $4}') 

    counter=$counter+7

    declare v2$i=$(aws iam get-group --group-name VideoEditors | awk -v counter3=$counter2 'NR==counter3' | awk -F\" '{print $4}')

    counter2=$counter2+7
    echo $v1$i
    echo $v2$i
done

I have a bash script which contains awscli as well. I am trying to print a variable which is created in a for loop. The variable that I am trying to print contains $ sign because of for loop. I couldn't print the value. Below I ams sharing the script. The output of this script is only numbers which is generated in the for loop. I want to print the value which is generated in the command.

#!/bin/bash

declare -i counter=11
declare -i counter2=14

for i in {1..2}
do
    declare v1$i=$(aws iam get-group --group-name VideoEditors | awk -v counter1=$counter 'NR==counter1' | awk -F\" '{print $4}') 

    counter=$counter+7

    declare v2$i=$(aws iam get-group --group-name VideoEditors | awk -v counter3=$counter2 'NR==counter3' | awk -F\" '{print $4}')

    counter2=$counter2+7
    echo $v1$i
    echo $v2$i
done

I have a bash script which contains awscli as well. I am trying to print a variable which is created in a for loop. The variable that I am trying to print contains $ sign because of for loop. I couldn't print the value. Below I am sharing the script. The output of this script is only numbers which is generated in the for loop. I want to print the value which is generated in the command.

#!/bin/bash

declare -i counter=11
declare -i counter2=14

for i in {1..2}
do
    declare v1$i=$(aws iam get-group --group-name VideoEditors | awk -v counter1=$counter 'NR==counter1' | awk -F\" '{print $4}') 

    counter=$counter+7

    declare v2$i=$(aws iam get-group --group-name VideoEditors | awk -v counter3=$counter2 'NR==counter3' | awk -F\" '{print $4}')

    counter2=$counter2+7
    echo $v1$i
    echo $v2$i
done

I have a bash script which contains awscli as well. I am trying to print a variable which is created in a for loop. The variable that I am trying to print contains $ sign because of for loop. I couldn't print the value. Below I ams sharing the script. The output of this script is only numbers which is generated in the for loop. I want to print the value which is generated in the command.

#!/bin/bash

declare -i counter=11 declare -i counter2=14

for i in {1..2} do declare v1$i=$(aws iam get-group --group-name VideoEditors | awk -v counter1=$counter 'NR==counter1' | awk -F" '{print $4}') counter=$counter+7 declare v2$i=$(aws iam get-group --group-name VideoEditors | awk -v counter3=$counter2 'NR==counter3' | awk -F" '{print $4}') counter2=$counter2+7 echo $v1$i echo $v2$i done

#!/bin/bash

declare -i counter=11
declare -i counter2=14

for i in {1..2}
do
    declare v1$i=$(aws iam get-group --group-name VideoEditors | awk -v counter1=$counter 'NR==counter1' | awk -F\" '{print $4}') 

    counter=$counter+7

    declare v2$i=$(aws iam get-group --group-name VideoEditors | awk -v counter3=$counter2 'NR==counter3' | awk -F\" '{print $4}')

    counter2=$counter2+7
    echo $v1$i
    echo $v2$i
done

I have a bash script which contains awscli as well. I am trying to print a variable which is created in a for loop. The variable that I am trying to print contains $ sign because of for loop. I couldn't print the value. Below I ams sharing the script. The output of this script is only numbers which is generated in the for loop. I want to print the value which is generated in the command.

#!/bin/bash

declare -i counter=11 declare -i counter2=14

for i in {1..2} do declare v1$i=$(aws iam get-group --group-name VideoEditors | awk -v counter1=$counter 'NR==counter1' | awk -F" '{print $4}') counter=$counter+7 declare v2$i=$(aws iam get-group --group-name VideoEditors | awk -v counter3=$counter2 'NR==counter3' | awk -F" '{print $4}') counter2=$counter2+7 echo $v1$i echo $v2$i done

I have a bash script which contains awscli as well. I am trying to print a variable which is created in a for loop. The variable that I am trying to print contains $ sign because of for loop. I couldn't print the value. Below I ams sharing the script. The output of this script is only numbers which is generated in the for loop. I want to print the value which is generated in the command.

#!/bin/bash

declare -i counter=11
declare -i counter2=14

for i in {1..2}
do
    declare v1$i=$(aws iam get-group --group-name VideoEditors | awk -v counter1=$counter 'NR==counter1' | awk -F\" '{print $4}') 

    counter=$counter+7

    declare v2$i=$(aws iam get-group --group-name VideoEditors | awk -v counter3=$counter2 'NR==counter3' | awk -F\" '{print $4}')

    counter2=$counter2+7
    echo $v1$i
    echo $v2$i
done
Source Link
Loading