tags:

views:

451

answers:

2

The code does not work

scp ~/Desktop/favicon.ico nameOfBashAlias:/public_html/mySite/templates/blog/

The alias is

alias nameOfBashAlias='ssh [email protected]'

How can you solve the problem?

[edit]

Is a similar code to the following code possible, like running many bashes?

scp ~/Desktop/favicon.ico (nameOfBashAlias)>:/public_html/mySite/templates/blog/

I did not get the above code to work.

+3  A: 

scp doesn't run bash. You would need to run this:

 scp ~/Desktop/favicon.ico 11.11.11.111:/public_html/mySite/templates/blog/

If all you have is the alias and the above code is not possible for you, consider running it like this:

nameOfBashAlias cat /public_html/mySite/templates/blog/ > ~/Desktop/favicon.ico

In this way, you're actually invoking ssh and directing the file content to a file on disk. This can be written the other way for uploads.

Jason Cohen
The first command should be scp ~/Desktop/favicon.ico [email protected]:/public_html/mySite/templates/blog/
Masi
+1  A: 

Aliases are substituted when they are the first word of a bash command. Your alias appears at the start of the third word.

I would use a shell variable for this.

blah='[email protected]'
scp ~/Desktop/favicon.ico ${blah}:/public_html/mySite/templates/blog/

Btw, I think your original alias shouldn't have ssh in it. And the last code sample has a > in it that looks wrong too.

mataap
@mataap: Thank you very much for your answer!
Masi