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
Post a Comment