bashlistloopstee

tee command creates empty file


I have the following list of stocks that is generated and it is placed in file called awk_1

dfs
fsd
dsf
sdf

I then run the following one liner which generates the correct ULR links

while read i ; do 
  echo $(http://uk.finance.yahoo.com/echartss=$i#symbol=$i\;range=my\;compare=\;indicator=volume\;charttype\=area\;crosshair\=on\;ohlcvalues\=0\;logscale\=off\;source\=undefined\;) tee stock_urls; 
done < awk_1 

However is does not put the output in the file called stock_urls?

Also it generate and strange output on the screen, below is a small section of the output that I get to standard output. It puts ./large_cap_stocks.sh: 51: ./large_cap_stocks.sh: at the front and not found at the end; why might that be happening?

I have searching high and low for why this is not working - any help would be really appreciated.


Solution

  • You probably meant to write like this:

    while read i; do
        echo "http://uk.finance.yahoo.com/echarts?s=$i#symbol=$i\;range=my\;compare=\;indicator=volume\;charttype\=area\;crosshair\=on\;ohlcvalues\=0\;logscale\=off\;source\=undefined\;"
    done < awk_1 | tee stock_urls
    

    That is: