I did search before posting this but cant find any matching issues. It looks like my find and replace is adding a return character to the end that I cant remove. The call is sh csv2postgres.sh import-tree-references
where csv2postgres.sh
is:
cname=$(printf $1 | sed -e "s/-/_/g")
echo $cname
echo "${cname}.csv"
cols=`head -n 1 "${cname}.csv"`
The results are:
import_tree_references
.csvrt_tree_references
head: cannot open 'import_tree_references'$'\r''.csv'
I tried echo/printf, I tried every combinations of " and {} I could think of, I tried adding the pipe | tr -d "\r"
. The head
command works fine if I just use $1
instead of cname
and change the command to sh csv2postgres.sh import_tree_references
, but the app I am working in will still be passing kebab case.
I am on ubuntu 18.10.
Any suggestions?