>I'm wondering if it was possible to make an interactive bash shell
>execute initial commands through command-line switches. Such as if those
>commands had been appended to $(HOME)/.bash_profile.
>It turns out that on my 4x4 fvwm desktop I always use the same layout
>with about 12 open shells, some of which are cd'ed to various
>directories and some are ssh'ed to other hosts. Rather than having to
>manually cd/ssh each shell to where I want it on each login, I'd like to
>have that setup done automatically.
It sounds like you're automatically starting up terminals at specific
locations. Does fvwm give the your terminal emulator any indication of what
workspace it's been started in? If so, you could put code in your
.bash_profile for each of the workspaces that does whatever you want.
I don't know how fvwm works, but the window manager I use (pmwm) makes each
window have X coordinates relative to its offset from the currently active
panner workspace. So, if you have a 4x4 workspace and the "top left" workspace
is active, the top left of that window will have X coordinates (0,0), the top
left of the "top right" workspace will have coordinates of (screen-width,0),
I want to give my shells knowledge of which workspace they are started in.
To accomplish that, I start with the WINDOWID environment variable set by the
terminal emulator I use (xterm does this too). I use xwininfo with the
WINDOWID to get its X coordinates. I use xdpyinfo to get the screen
dimensions. Trivial math then gives the workspace that this is being run in.
It's only useful at startup, when the active workspace is 0,0 and (until the
workspace is changed) each shell will be running in a window that has X
coordinates that reflect the location of that shell within the panner space.
So, in my .profile I run a program that gathers this information, and code in
.profile stores it for later use, both in a shell variable and in a file (named
by pty) that can be read by other utilities. One such utility shows me a
ps-like listing of what interesting jobs I'm running, with the workspace each
job is running in (and what key-combination I'd use to go directly to that
The "report what workspace this is" utility is at