Announcement

Collapse
No announcement yet.

alias trouble [SOLVED]

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    alias trouble [SOLVED]

    Hi all,
    I've been trying to set up my first permanent alias and I'm running into a problem now that Im not sure what to do about. For some reason when I want to start my vpn software I have to use this series of commands (my system admin set it up), rather than the gui interface. This is fine but I'd like to use an alias for it.

    The commands are:
    Code:
    $ cd /opt/cisco/vpn/bin
    
    $ sudo ./vpnui
    And then I type in my password and the program runs.

    I want to set up an alias for this so I put this in my .bash_aliases file:
    Code:
    [code]alias vpn='cd /opt/cisco/vpn/bin | sudo ./vpnui'
    [/code]

    When I try to use my new alias it asks me for my password for sudo but then gives me this error:
    Code:
    ./vpnui: command not found
    Why does this command not work inside the alias but works fine when I do it by hand?

    Thanks
    System Information<br />Distro: Ubuntu 11.04<br />KDE: Platform Version 4.6.2<br />Grub: 0.97-29ubuntu61.1 GRand Unified Bootloader (Legacy version)<br /><br />PC Hardware:<br />laptop HP Pavilion dv6<br />CPU: AMD Turion(tm) II P520 Dual-Core Processor<br />GPU: ATI Technologies Inc M880G [Mobility Radeon HD 4200]

    #2
    Re: alias trouble

    alias vpn='cd /opt/cisco/vpn/bin | sudo ./vpnui'
    Because you don't want to pipe the output of the cd command, you want to run the two in sequence.

    Try: alias vpn='cd /opt/cisco/vpn/bin && sudo ./vpnui'

    But I don't know if this will work either. You might be better off setting this up as a shell script
    We only have to look at ourselves to see how intelligent life might develop into something we wouldn't want to meet. -- Stephen Hawking

    Comment


      #3
      Re: alias trouble

      Why not simply

      Code:
      sudo /opt/cisco/vpn/bin/vpnui
      The only reason you needed to cd to the directory was so you could issue the command from that location and skip the full path.

      Comment


        #4
        Re: alias trouble

        Thanks guys, both of those solutions worked. I thought when I used the "|" symbol that I was having those two commands run in succession. Time for me to go google piping now...
        System Information<br />Distro: Ubuntu 11.04<br />KDE: Platform Version 4.6.2<br />Grub: 0.97-29ubuntu61.1 GRand Unified Bootloader (Legacy version)<br /><br />PC Hardware:<br />laptop HP Pavilion dv6<br />CPU: AMD Turion(tm) II P520 Dual-Core Processor<br />GPU: ATI Technologies Inc M880G [Mobility Radeon HD 4200]

        Comment

        Working...
        X