quoting - Preserve Interpretation in Bash Variable -
i'm trying preserve interpretation in bash variable.
example
when run following line @ command prompt.
rm aaa 2>> error_file ; echo '<br><br>' >> error_file
i following (which want):
rm: cannot remove `aaa': no such file or directory
if put error handling code in variable blows-up.
error_han="2>> error_file ; echo '<br><br>' >> error_file" rm aaa $error_han rm: cannot remove `"2>>"': no such file or directory
i have tried quoting number of ways no luck. can't seem preserve interpretation 2>>
portion of variable.
use eval
:
eval rm aaa ${error_han}
Comments
Post a Comment