Skip to main content
Bumped by Community user
Corrected text, add tag
Source Link

combining Combining a variable value and string to form another variable

I want to reference a bash variable from a variable without using:

echo "${!VARNAME}"

Any ideas? Since iI want to use the variable on fly and many such references are there, i cantI can't declare them to another variable and use it.

exampleExample:

var1=host
${var1}_file ----> host_file is another variable that i want to call in a command. 

combining a variable value and string to form another variable

I want to reference a bash variable from a variable without using

echo "${!VARNAME}"

Any ideas? Since i want to use the variable on fly and many such references are there, i cant declare them to another variable and use it.

example:

var1=host
${var1}_file ----> host_file is another variable that i want to call in a command. 

Combining a variable value and string to form another variable

I want to reference a bash variable from a variable without using:

echo "${!VARNAME}"

Any ideas? Since I want to use the variable on fly and many such references are there, I can't declare them to another variable and use it.

Example:

var1=host
${var1}_file ----> host_file is another variable that i want to call in a command. 
deleted 5 characters in body
Source Link

I want to reference a bash variable from a variable without using

echo "${!VARNAME}"

Any ideas? Since i dont want to use the variable on fly and many such references are there, i cant declare them to another variable and use it.

example:

var1=host
${var1}_file ----> host_file is another variable that i want to call in a command. 

I want to reference a bash variable from a variable without using

echo "${!VARNAME}"

Any ideas? Since i dont want to use the variable on fly and many such references are there, i cant declare them to another variable and use it.

example:

var1=host
${var1}_file ----> host_file is another variable that i want to call in a command. 

I want to reference a bash variable from a variable without using

echo "${!VARNAME}"

Any ideas? Since i want to use the variable on fly and many such references are there, i cant declare them to another variable and use it.

example:

var1=host
${var1}_file ----> host_file is another variable that i want to call in a command. 
Format code as code.
Source Link
John1024
  • 76.4k
  • 12
  • 176
  • 165

I want to reference a bash variable from a variable without using

echo "${!VARNAME}"

echo "${!VARNAME}"

Any ideas? Since i dont want to use the variable on fly and many such references are there, i cant declare them to another variable and use it.

example:

var1=host ${var1}_file ----> host_file is another variable that i want to call in a command.

var1=host
${var1}_file ----> host_file is another variable that i want to call in a command. 

I want to reference a bash variable from a variable without using

echo "${!VARNAME}"

Any ideas? Since i dont want to use the variable on fly and many such references are there, i cant declare them to another variable and use it.

example:

var1=host ${var1}_file ----> host_file is another variable that i want to call in a command.

I want to reference a bash variable from a variable without using

echo "${!VARNAME}"

Any ideas? Since i dont want to use the variable on fly and many such references are there, i cant declare them to another variable and use it.

example:

var1=host
${var1}_file ----> host_file is another variable that i want to call in a command. 
added 110 characters in body; edited tags
Source Link
Loading
Source Link
Loading