bash - echo from a function that returns a string to the calling function causes newlines to appear before the string -


i trying return s3 link bash function using echo.

function1(){ sample_code_line1 sample_code_line2 s3_link="http://xxxx-xxxxxx.s3.amazonaws.com/krd-4386801114873926480_15224268_komaccas-monopoly-app-au-ios-production-bnfvp.event201704301400-201705071400-tz_australia-nsw.csv?awsaccesskeyid=akiaj4jwd2ocxdyvog4a&expires=1503638429&signature=oesbonqkedmuycsn%2bwu%2fjs7%2f27u%3d" echo "$s3_link" }  s3_report_link="$(function1 "${arg1}" "${arg2}")" curl -o report.csv "${s3_report_link}" 

the curl command produces error because returned string containing s3 link has preceding newlines it. although, have no issues removing newlines; curious know why behavior occurs in first place. when run script in debug mode, can see variable s3_link carries string without newlines when passed does.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -