Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-12-2009, 01:50 AM   #1
Registered: Nov 2008
Location: S.W. Kansas
Distribution: Slackware64 14.0
Posts: 230
Blog Entries: 2

Rep: Reputation: 41
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, )

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?
Old 07-12-2009, 02:21 AM   #2
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
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).


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ns:"error when calling class OldSim"&tclsh:"invalid command+child process exits abn." shojaru Linux - Newbie 0 03-05-2009 04:23 AM
"NIM thread blocked" & "Deadman Switch (DMS) close to trigger" errors sosborne Linux - Networking 1 06-28-2006 02:07 PM
How to start KDE automaticlly without typing "startx" then "startkde" Jonescity Slackware 8 10-29-2004 09:32 PM
bash equivalence of tcsh "alias em "emacs \!:1 &""? rgiggs Slackware 3 07-29-2004 02:07 AM
what does this "startx > output 2>&1" mean? whepin Linux - General 1 12-30-2001 09:19 AM

All times are GMT -5. The time now is 12:46 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration