Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    He could just use single quotes, i.e. export STY='for i in {0..3}; do echo $i; done' Commented Feb 25, 2012 at 1:44
  • @Perry Six one way, half-dozen the other. Commented Feb 25, 2012 at 1:45
  • is it possible that we can execute the code contained in environment variable on command line? Commented Feb 25, 2012 at 1:57
  • By the way, if I do export such as export pqr="time ls" and if I specify this variable in some script then the code executes but if I place a for loop within this environment variable then shell yells at me and say for command not found. Commented Feb 25, 2012 at 2:31
  • @Shazard, this answer implies you use SST as function. DATA=`STY()` (note left quotes - they get standard output of expression). To execute non-function variable (closer to your example) use eval $STY Commented Feb 25, 2012 at 2:58