2

I got a very simple alias on my bash:

alias xfreerdpp='xfreerdp /v:ip_address /u:username /d:domain /p:password /size:1024x768 /clipboard /cert-ignore &'

All I want to do is to make the ip_address a variable so that I can type xfreerdpp xxx.xxx.xxx.xxx, passing ip_address as an argument.

dr_
  • 29,602
  • See http://unix.stackexchange.com/questions/30925/in-bash-when-to-alias-when-to-script-and-when-to-write-a-function – Evgeny Jul 27 '15 at 16:19

2 Answers2

2

You can add the following to your ~/.bashrc and source it then.

xfreerdpp() {
    xfreerdp /v:$1 /u:username /d:domain /p:password /size:1024x768 /clipboard /cert-ignore &
}

To execute: xfreerdpp xxx.xxx.xxx.xxx

Please also consider the security concern raised by @Nasha too.

In order to pass the password as an argument you can do:

xfreerdpp() {
    xfreerdp /v:$1 /u:username /d:domain /p:$2 /size:1024x768 /clipboard /cert-ignore &
}

And then execute: xfreerdpp xxx.xxx.xxx.xxx password

neuron
  • 1,976
0

I would personally drop the ampersand otherwise you'd need a script or a shell function. Over too complicated for a start. Here you go:

alias xfreerdpp='/usr/bin/xfreerdp \
    /u:username /d:domain /p:password \
    /size:1024x768 /clipboard /cert-ignore'

Invocation:

xfreerdp /v:345.16.54.12 &

(I know about the 345 in IP addresses, I watched «The Net» with Sandra Bullock ;-) )

Joke aside, just be aware that storing a password in clear form as an alias is a security breach in itself. Prefer manual authentication.

  • It worked perfectly. Tyvm @Nasha. I'm aware of the security risk, the problem is that sometimes, people sit with me to troubleshoot and i'm not comfortable typing my pw with them looking. – rhittmann Jul 27 '15 at 18:28