-   Programming (
-   -   alias startdwm="export MYWM=dwm & startx" (

Mol_Bolom 07-12-2009 01:50 AM

alias startdwm="export MYWM=dwm & startx"
I had made some aliases to my .profile that would create a variable to be used in my .xinitrc file, for trying some new things out, and I found that when I use the aliases I created such as the title of this thread the variable MYWM doesn't get created or changed. I'm thinking that & should not be used here.

Also, unfortunately, I wasn't able to find anything that explained this, or even a listing of bash symbols...Well, I did find one, but it was about how to enter those symbols as characters not what they did.


alias startdwm="export MYWM=dwm & startx"
alias startobdwm="export MYWM=openboxdwm & startx"
alias startopenbox="export MYWM=NA & startx"
alias startratpoison="export MYWM=ratpoison & startx"


if [ $MYWM = variablename ]
    exec windowmanager

(Rather than list every single if statement, I'll just write that, keeping it easy to read, :D)

Thanks upfront...

P.S. For future reference, would anything that is related to scripting belong in the programming section of LQ or would a question like this belong elsewhere?

colucix 07-12-2009 02:21 AM

To export a variable, use a function instead:

function startdwm() {
  export MYWM=dwm

Note that & is used to runn commands in background and it is actually not needed to export a variable in background. To run more commands in sequence you can use a semi-colon (the commands separator) or eventually && (which means "if the previous command run successfully then run the following command).

All times are GMT -5. The time now is 07:31 PM.