bash - Redirected output is interpreted when file is given as a variable -


when following within bash script file:

#!/bin/bash  echo -e $line >> 2.txt 

... $line written inside 2.txt file without troubles. however, if use variable file this:

#!/bin/bash file='2.txt' echo -e $line >> $file 

... escaped \$ interpreted , in file '$' character written. outside of bash script file (in bash console) both codes work. know why? not information on on internet.


Comments

Popular posts from this blog

iphone - Three second countdown in cocos2d -

hyperlink - how to do url routing in php -

c - Avoiding Extra Malloc in Linked List (node->next = NULL) -