I have a script which contains the following:
sftp $2@$3 <<< $"cd $4 \nput $5 \nbye"
which I pass variables too at runtime however, the \n
characters are not rendered as new lines but are rendered as plaintext so the commands attempts to to the following:
sftp > cd $4\nput $5 \nbye
which is obviously a directory which doesn't exist, how can i make the new line characters persist?
if i dont parameterise the command it works fine eg.
sftp user@host <<< $'cd dir\n put file\n bye'
any ideas?
Maybe is due the the user of '
vs "
in the script?