sh: variable substitution with heredoc -
below part of script
cat "${pos}" | /usr/bin/iconv -f cp1251 -t utf-8 | uniq | sed -en "/^client_id.*/!p" | while read line ..... ...... cat >> "$tmpfile" << eof insert ......; eof done
as can see iteration write sql statenment tmp-file. launched script regular user makes output expect, cron job - nothing. after investigation have found problem. when use "$tmpfile"
without ""
script works ok. so, can explain me why happens? os: freebsd, bourne shell.
iirc, cron
doesn't source files login shell does, end different settings environment variables. path $tmpfile
pointing contains spaces when run cron
example.
also, on systems (depending on setup), cron
uses different shell. if start script command line, example /usr/bin/sh
might used, whereas when started cron
, /bin/sh
used. (i have no experience *bsd, have observed on linux.)
Comments
Post a Comment