Eduardo Sanz Garcia wrote:


Eduardo Sanz Garcia wrote:
Matthew Gardner wrote:
So, I was trying to run mysql on my computer at home to do some rails stuff (just playing around, and moving a CS 360 project to my computer so I could see it at home - I'm running OSX 10.5, if that's important), and it works fine, but to start the daemon the installation is requiring that I be in the directory with the mysql bin/ folder. I thought that was kind of annoying, so I decided to make an alias in my .bashrc to change directories, start the process, then change back. Probably an easier way to do it would be to put in the alias all of the options that make it so I don't have to do the change directories business, but I'm not sure what all of those options are. Anyway, this was the alias that I put in .bashrc: alias 'mysql-start'='cd ~/Documents/mysql-5.0.51b-osx10.5-x86; bin/mysqld_safe --defaults-file=my.cnf &; cd ~-'

Try

alias 'mysql-start'='cd ~/Documents/mysql-5.0.51b-osx10.5-x86; bin/mysqld_safe --defaults-file=my.cnf & cd ~-'

I don't see very cleary the symbol after cd but I believe that should be "cd -" not "cd ~-" if you want to return to your previous directory.

The other's people suggestions are better, but just for fun...
|cd -| use the variable |OLDPWD|. If you start a new shell this variable is not set. If you would like to avoid a warning of this type:
bash: cd: OLDPWD not set
you could use this construction "|cd ${OLDPWD:=~}|" The |${||OLDPWD||:=value} |||||form will assign |OLDPWD| to |OLDPWD| if |OLDPWD| is unset or set but null, if not, |OLDPWD |will assign the default |value|||.
I just liked the |:=~ |expression...
--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info: http://uug.byu.edu/mailman/listinfo/uug-list

Reply via email to