You are not logged in.

#1 2011-03-19 15:50:50

lagagnon
Member
From: an Island in the Pacific...
Registered: 2009-12-10
Posts: 1,087
Website

How to run a .bashrc alias from my .xinitrc file?

I use my .xinitrc file to launch a few apps before my window manager. I also want to launch a small bash alias I have in my .bashrc, but it does not get launched from .xinitrc. I gather this is because a .bashrc only works from a non-login terminal session. Other than adding my .bashrc alias to a system wide script in say /usr/local/bin is there any other way to do it?


Philosophy is looking for a black cat in a dark room. Metaphysics is looking for a black cat in a dark room that isn't there. Religion is looking for a black cat in a dark room that isn't there and shouting "I found it!". Science is looking for a black cat in a dark room with a flashlight.

Offline

#2 2011-03-19 16:14:22

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to run a .bashrc alias from my .xinitrc file?

If

alias foo="bar baz"

and putting 'foo' doesn't work, put 'bar baz' in .xinitrc.

Offline

#3 2011-03-19 22:51:58

McDoenerKing
Member
From: Germany
Registered: 2010-06-21
Posts: 59

Re: How to run a .bashrc alias from my .xinitrc file?

Well you shouldn't use aliases in scripts anyways since its slower and less portable to other systems smile
Are you starting your DE directly at boot? If yes, that might be the problem wink

Offline

#4 2011-03-19 23:29:19

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: How to run a .bashrc alias from my .xinitrc file?

Usually you cannot run a script with aliases. See [man bash]:

       Aliases are not expanded  when  the  shell  is  not  interactive,  unless  the
       expand_aliases  shell  option is set using shopt

Aliases are primarily meant for interactive use on the command line.


To know or not to know ...
... the questions remain forever.

Offline

#5 2011-03-20 15:48:55

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: How to run a .bashrc alias from my .xinitrc file?

Use funcs instead of aliases. You can source a file containing funcs and call them as you like.


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

Board footer

Powered by FluxBB