Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I achieve the following:

type vdm in the terminal and that will be replaced by wine Program Files/The VDM++ Toolbox Lite v8.3.1/bin

I also wanted vdm to work in any folder I am whatsoever.

share|improve this question

3 Answers 3

up vote 5 down vote accepted

Create a text file

~/.bash_aliases

and put

alias vdm='wine "Program Files/The VDM++ Toolbox Lite v8.3.1/bin"'

in it. You'll need to restart your shell for it to take effect.

The .bash_aliases file is safer and easier to edit than editing the .bashrc file directly. It's automatically loaded by .bashrc on 11.04 and later.

See also this question.

share|improve this answer
1  
That's a good point. ~/.bash_aliases is a better place for Aliases. –  Oli Nov 2 '11 at 12:51

The quickest way is via an alias. They look as simple as this:

alias vdm='wine "C:\Program Files\The VDM++ Toolbox Lite v8.3.1\bin"'

After you plumb that in, you can run vdm (as long as it's from a bash shell) and your Wine command will run. You may need to play around with the syntax of the Wine statement a little.

For that to persist, you'll need to save it to one of your bash configurqation files. My original post suggested just adding that line to ~/.bashrc but as root54 points out, you should probably use ~/.bash_aliases if you're on a relatively new install. If it doesn't exist, don't worry, just create a new file and stick that line in.

After you make changes to either of those files, you need to run source . to reload bash's config.


Alternatively you can create a bash function, again in ~/.bashrc:

function vdm {
    wine "C:\Program Files\The VDM++ Toolbox Lite v8.3.1\bin"
}

Again, after putting this in, you'll want to run source .


And finally, if you need something more meaty (you don't for this simple command) you can write a full script and stick it in ~/bin.

mkdir -p ~/bin
touch ~/bin/vdm
chmod +x ~/bin/vdm
nano vdm

And copy in something like this:

#!/bin/bash

wine "C:\Program Files\The VDM++ Toolbox Lite v8.3.1\bin"

The advantage of bin scripts over anything else is they're slightly more portable. You don't have to hack apart or replace your .bashrc if you want to take them to another computer. But they're a bit more fuss to create.

share|improve this answer

In your terminal type alias vdm='wine Program Files/The VDM++ Toolbox Lite v8.3.1/bin

If you reboot, though, it will most likely be unset, so you will have to put the line inside the ~/.bashrc file.

so gedit ~/.bashrc and at the bottom, paste the alias-line in the file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.