Skip to content

Host aliases

fscheiner edited this page Jun 20, 2013 · 13 revisions

(gtransfer) host aliases

What is a host alias?

A so-called host alias is a string (e.g. myGridFTP:) which is mapped to a host address (e.g. gsiftp://host.domain.tld:2811). Gtransfer supports host aliases by using a small helper tool named halias. In gtransfer both the alias and its expansion can be used synonymical. E.g.:

gt -s gsiftp://host.domain.tld:2811/~/file1 -d gsiftp://host.domain.tld:2811/~/file2

...and...

gt -s myGridFTP:/~/file1 -d myGridFTP:/~/file2

...will perform the same transfer.

Alias mapping

Aliases can be mapped to host addresses either by means of a file or a directory. If many aliases are available the expansion will be faster if you are using a directory. Therefore the recommendation is to use a directory as alias source by default.

Alias mapping with file

$ cat aliases
alias1:;gsiftp://host.domain.tld:2811
myGridFTP:;alias1
alias3:;$( doSomething )
alias4:;$( doSomethingWith %alias )

This exemplary alias source also shows what is currently possible:

  • alias1: will be expanded to the host address gsiftp://host.domain.tld:2811
  • myGridFTP: maps to alias1 which itself is again an alias. myGridFTP: will therefore also be expanded to the host address gsiftp://host.domain.tld:2811
  • alias3: maps to a so-called command substitution and will therefore be expanded to what doSomething prints out.
  • alias4: is similar to alias3: but uses the %alias keyword. This keyword is expanded to the actual alias string (alias4 in this case) before the command is executed. This way you can use the alias string inside of the command substitution.

CAUTION To perform the command substitution and to retrieve the output, the eval command is used internally. Therefore be careful not to map to something like rm -rf ~/*, as this command would be executed during expansion.

Alias mapping with directory

This uses the same mapping as the file above and will be expanded the same way.

$ ls -1 aliases.d
alias1:
myGridFTP:
alias3:
alias4:

File contents of alias1:

gsiftp://host.domain.tld:2811

File contents of myGridFTP:

alias1:

Alternatively you could also use a symlink to alias1: (saves the time for the second expansion)

File contents of alias3:

$( doSomething ) 

File contents of alias4:

$( doSomethingWith %alias )
Clone this wiki locally