Results 1 to 4 of 4

Thread: Bash Alias help.

  1. #1
    Join Date
    Oct 2007
    Beans
    10

    Bash Alias help.

    Anyone know why this does not work or have a better idea for creating this alias?

    alias rd='rdesktop -g 1200x700 $1 &'

    from the terminal I am trying to alias rdesktop using 'rd <server>' without hanging the current terminal session.

    I can remove the & and the alias works, but not with it. Should I be doing this another way?

    Thanks!

  2. #2
    Join Date
    Nov 2009
    Beans
    Hidden!
    Distro
    Kubuntu 10.10 Maverick Meerkat

    Re: Bash Alias help.

    Functions are ideal for this purpose. You can pass your <server> param as $1 into a function, which then can append the ampersand.

    function rd()
    {
    rdesk....blabla.. ${1} &
    }

  3. #3
    Join Date
    Oct 2007
    Beans
    10

    Re: Bash Alias help.

    Excellent. Thank you.. That just opened up a new world for me. Much appreciated!

  4. #4
    Join Date
    Feb 2010
    Location
    Silicon Valley
    Beans
    1,898
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: Bash Alias help.

    Quote Originally Posted by sparcxl View Post
    Anyone know why this does not work
    It does not work in bash because aliases do not take arguments. And as John pointed out, functions do.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •