-
Notifications
You must be signed in to change notification settings - Fork 3
Host aliases
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.
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.
$ 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 addressgsiftp://host.domain.tld:2811
-
myGridFTP:
maps toalias1
which itself is again an alias.myGridFTP:
will therefore also be expanded to the host addressgsiftp://host.domain.tld:2811
-
alias3:
maps to a so-called command substitution and will therefore be expanded to whatdoSomething
prints out. -
alias4:
is similar toalias3:
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 likerm -rf ~/*
, as this command would be executed during expansion.
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 )