Tatarinho
Tatarinho

Reputation: 784

Bash 'scp' command with parameters

I'm totally new in Bash programming, so please don't feel offended with my question. I'm trying to use SCP command with parameters from configuration file. Now my code looks like below

#!/usr/bin/bash

source $1

echo $HOST
echo $USER
echo $DIRECTORY

scp ${USER}@${HOST}:/${DIRECTORY}/file.zip .

And my output is:

111.111.11.111
user1
/home/repo/test/
: Name or service not knowname 111.111.11.111

If I will remove ${HOST} from command and I'll paste address directly, it's working perfectly. Other variables are passed without problem. Do you have any idea where I'm doing it wrong? I am completely lost. I'm running this script from Cygwin terminal, but I think it's not a problem.

Upvotes: 0

Views: 1954

Answers (1)

Tatarinho
Tatarinho

Reputation: 784

According to Jakuje comment, the problem was in config file. I've changed EOL conversion to UNIX and it's working perfectly.

Upvotes: 1

Related Questions