0
The documentation from tldp.org doesn't really specify when or how the bash interpreter replaces an aliased string. I'm looking for information on how to create an alias that is an incomplete command.
alias quickscp="scp a.really.long.internal.domain.name:"
quickscp/data/testfile ./testfile
This fails - looks like bash doesn't expand testalias
unless it is matching a string with whitespace (^/$ included I assume) surrounding it.
It would be nice if aliases could assume some of the functionality of the C preprocessor, such as macro expansion,
http://tldp.org/LDP/abs/html/aliases.html agrees with me here - "it would be nice if" implies that it does not behave like a C preprocessor. Is there any way to force it? Something specific to the scp case above would solve my problem, but I'd be interested to know if there's a way to get the logic I'm trying to implement as well (for future hackery).
I guess this can be tl;dr'd to: How do I get bash to expand an alias if it isn't surrounded by whitespace?
There is no point in
$@
, since there is only onetarget
argument inscp
. – slhck – 2020-01-22T15:34:38.723@slhck I know. I wanted the approach to mimic a desired alias-like behavior for any command. Some other commands may make sense with
$@
. – Kamil Maciorowski – 2020-01-22T15:37:12.867Sure, I was going to do the same, but figured it wouldn't make a lot of sense, particularly when the options for scp (should the user want any) would have to be placed before the source/target. Good alternative with the hostname definition! – slhck – 2020-01-22T16:04:55.480