Skip to main content
deleted 62 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 237

I am having some problem with bash. I want to export an environment variable whose value contains a variable but I don't want that variable (which is within the value) to be evaluated during the export process. i.e.

export STY=for i in {0..3}; do echo $i; done

so my requirement is that when I echo STY, the output that I need should be

echo $STY
for i in {0..3}; do echo $i; done 

But $i is evaluated during export. I need to preserve it as it is.

Thanks alot for your help.

I am having some problem with bash. I want to export an environment variable whose value contains a variable but I don't want that variable (which is within the value) to be evaluated during the export process. i.e.

export STY=for i in {0..3}; do echo $i; done

so my requirement is that when I echo STY, the output that I need should be

echo $STY
for i in {0..3}; do echo $i; done 

But $i is evaluated during export. I need to preserve it as it is.

Thanks alot for your help.

I want to export an environment variable whose value contains a variable but I don't want that variable (which is within the value) to be evaluated during the export process. i.e.

export STY=for i in {0..3}; do echo $i; done

so my requirement is that when I echo STY, the output that I need should be

echo $STY
for i in {0..3}; do echo $i; done 

But $i is evaluated during export. I need to preserve it as it is.

Post Migrated Here from stackoverflow.com (revisions)
Source Link
Shahzad
  • 111
  • 3

Exporting environment variable

I am having some problem with bash. I want to export an environment variable whose value contains a variable but I don't want that variable (which is within the value) to be evaluated during the export process. i.e.

export STY=for i in {0..3}; do echo $i; done

so my requirement is that when I echo STY, the output that I need should be

echo $STY
for i in {0..3}; do echo $i; done 

But $i is evaluated during export. I need to preserve it as it is.

Thanks alot for your help.