[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] getting bash sh to read in personal config
From: |
Bob Proulx |
Subject: |
Re: [Help-bash] getting bash sh to read in personal config |
Date: |
Thu, 15 Oct 2015 21:56:37 -0600 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
David Niklas wrote:
> Greg Wooledge wrote:
> > David Niklas wrote:
> > > As you may or may not know, fvwm uses a config file for menus and
> > > all menu items are executed via sh (or so I beileve). I wanted to
> > > define some variables for arguments such as a font to keep the size
> > > of the menu down, and make accessing these long arguments easier I
> > > want to place them in a file.
You are refering to the use of "/bin/sh -c 'command'" in order to run
arbitrary shell commands in the "Exec" handling? This will run
/bin/sh. However...
On your system /bin/sh may or may not be bash. On many systems it is
linked to dash. If it is dash or other then it won't run any bash
specific environment script.
> > I truly believe it would be best to put
> > the commands you want to run directly into your ~/.fvwm/.fvwm2rc file.
> > Tracking stuff down (when it inevitably needs to change) across
> > multiple files is no fun.
I think so too. However I will suggest an alternate plan.
> But if you want your terminal to have a black background and white
> foreground and use a particular font (I don't always code in X), then it
> is far easier to either make an alias, or use variables to store the
> extra args/options as opposed to having to copy and paste the same
> values over and over again into .fvwmrc, you see, the fvwm menu contains
> several commands, and I intend to add more, where the command is
> executed in the terminal which requires that I set the terminals
> settings many (think 20+) times. The same thing applies to other
> commands, which for brevity, I'm omitting.
> This way, I always have a global environment for my user which I can
> depend on, cross application, if I set it up right.
I suggest using X resources with different names.
For example with XTerm you can create these X resources entries. (You
may not be using an XTerm but since you didn't say I will assume
something generic and hope it applies to your specific program.)
XTerm*Foreground:Green
XTerm*Background:Black
debug*Foreground:White
debug*Background:Black
debug*Geometry:80x50
editor*Foreground:Yellow
editor*Background:Black
editor*Geometry:132x80
For the example above if I invoke an xterm normally like this then I
get green on black with the default 80x24 size.
$ xterm &
On the other hand if I assign the name "debug" then it will use the
"debug" X resources. It will be white on black and 80x50.
$ xterm -name debug &
And if "editor" then it will use the editor resources. It will be
yellow on black and 132x80.
$ xterm -name editor &
Simply assign the different configurations you wish to the different
resources.
> > ENV Similar to BASH_ENV; used when the shell is invoked
> > in POSIX mode.
>
> For posterity's sake I set this in /etc/profile to
> export ENV=~/.profile
> export BASH_ENV=~/.profile
Eww... Putting that into /etc/profile polutes everyone's
environment. Not good.
Bob