Skip to main content
added 79 characters in body
Source Link
jijinp
  • 1.4k
  • 10
  • 10
#!/bin/bash

array0=('echo Foo' 'export CCACHE=true' 'export FOO_FLAG=true' 'unset BAR_FLAG')

echo -n "Enter the elements: "

read -e line

for index in $@;do$line;do
        ${array0[index]}
done

Usage: script.sh 0 3 1

First index of an array is 0.

#!/bin/bash

array0=('echo Foo' 'export CCACHE=true' 'export FOO_FLAG=true' 'unset BAR_FLAG')

for index in $@;do
        ${array0[index]}
done

Usage: script.sh 0 3 1

First index of an array is 0.

#!/bin/bash

array0=('echo Foo' 'export CCACHE=true' 'export FOO_FLAG=true' 'unset BAR_FLAG')

echo -n "Enter the elements: "

read -e line

for index in $line;do
        ${array0[index]}
done

Usage: script.sh

First index of an array is 0.

Source Link
jijinp
  • 1.4k
  • 10
  • 10

#!/bin/bash

array0=('echo Foo' 'export CCACHE=true' 'export FOO_FLAG=true' 'unset BAR_FLAG')

for index in $@;do
        ${array0[index]}
done

Usage: script.sh 0 3 1

First index of an array is 0.