Results 1 to 3 of 3

Thread: bashrc produced unexpected results

  1. #1
    Join Date
    Jul 2005
    Location
    Brazil
    Beans
    25
    Distro
    Ubuntu 12.04 Precise Pangolin

    bashrc produced unexpected results

    Creating an alias for my ssh command to my proxy server I added the line like this line to ~/.bashrc

    alias linkname=`ssh -D 7777 -p 2299 username@example.com`

    Then to test it I fired up a new shell and, to my suprise, after a second or two of delay, it showed a login screen for my server at example.com. Confused I remarked out the new line and started another new shell. This did the expected thing and showed a local login screen. Examination of my new line in .bashrc showed that I had used backticks instead of single quotes. I changed the entry to
    alias linkname='ssh -D 7777 -p 2299 username@example.com'
    This now works as I intended and logs me into the remote server.

    Can someone explain what happened and why? Are backticks part of the syntax for an alias? Are there any interesting tricks I can use with them?

  2. #2
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: bashrc produced unexpected results

    Last edited by schragge; March 26th, 2013 at 05:58 PM.

  3. #3
    Join Date
    Jul 2005
    Location
    Brazil
    Beans
    25
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: bashrc produced unexpected results

    Thanks, I sort of knew about command substitution but had not realised that, in effect, .bashrc is a script and runs commands.

Tags for this Thread

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
  •