Forum
How to echo a semicolon in an alias?
Created 15th November 2011 @ 12:35
Add A Reply Pages: 1
What the title says ^
I want an alias to print a connect string to console for copy/pasting cuz lazy, but semicolons are interpreted to terminate the line/cmd. Can it be escaped or something?
Something along the lines of
alias "con1" "echo connect s1.colonslash.eu:28001; password lolright"
Last edited by Spike Himself,
bind it directly? like
bind “F1” “connect s1.colonslash.eu:28001; password lolright”
works for me, and saves the trouble of copy pasting it
Quoted from jonii
bind it directly? like
bind “F1” “connect s1.colonslash.eu:28001; password lolright”
works for me, and saves the trouble of copy pasting it
Yeah, I have the bind already – that’s not the issue.
I don’t want to paste it in console myself – I want to paste it on mumble/steam to team mates :)
Apparently:
<+freshmeatt> Can’t be escaped in an alias,
<+freshmeatt> Although if you put the say/echo command in another cfg file and just exec it, it’ll parse it right.
<+freshmeatt> Try putting in console say aaa;bbb – it will actually parse that right.
Will have to try that out when I get home ))
Last edited by Spike Himself,
if you have a bind to connect to it, you can also do “bind key” and it’ll echo the connect too, like bind f1 will echo the command that you have for f1
if you want to do it for servers you don’t have a bind to connect to dunno :<
only way i know is as freshmeat said.
set up one .cfg per server containing
echo “connect server1:27015;password test”
and then exec those files.
It’s not possible to do it with an alias due to the way that arguments to an alias are handled (and for some reason there is no escape, thanks Valve).
As you can see, echo handles quotes as requesting literal interpretation.
] echo “connect foo; password bar”
connect foo; password bar
] echo connect foo; password bar
connect foo
Clearly the quoting does make a difference in this case, but what about in other cases?
] alias foo echo “connect foo; password bar”
] foo
connect foo
] alias
Current alias commands:
foo : echo connect foo; password bar
As you can see, the effects of quoting seem to be specific to the command being run. My best guess (with no source available) is that the quotes are passed literally to the command, which then decides what to do with them, and this behaviour is not standardised.
There also appears to be a complete lack of an escape character in TF2, which is kind of annoying.
The best option is probably something like putting echo "connect foo; password bar"
in a config file, and then aliasing an exec of it.
Add A Reply Pages: 1