This issue is that the shell is splitting 'import Pkg' by space delimiter, so the equivalent of julia -e 'import is being executed, hence the incomplete: premature end of input error.
You can control the splitting using the IFS shell variable (aka Internal Field Separator or Input Field Separator). This can be redefined as, say, just a new line character. So wrapping the julia invocation might be the answer here: