Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: mikshaw on December 11, 2008, 08:19:51 AM

Title: .xsession and .profile
Post by: mikshaw on December 11, 2008, 08:19:51 AM
I assumed the .xsession file was pretty much the same as .xinitrc in many other distros, but for some reason some commands don't work.
I'm trying to add X fonts using xset +fp /path/to/fonts and to modify my keys with xmodmap, but neither seem to work unless I run the commands manually after the desktop loads.   I've tried reorder ing the commands and even adding a pause so Xvesa can load before running the commands, but they just don't work.  I added a command in the same area to run wbar, and that works fine, so I know the file is running.  I get no output to read, maybe due to the redirect to /dev/null in startx.

Current .xsession:
Code: [Select]
Xvesa -br -mouse /dev/psaux,5 -screen 1024x768x32 -shadow -nolisten tcp -I 2>&1 > $HOME/X.log &

#while [ ! -e /tmp/.X11-unix/X0 ]; do false; done
until pidof Xvesa; do false; done
#f=$HOME/.fonts
#xset b off +fp $f/artwiz,$f/lfp-fix,$f/proggy,$f/sgi,$f/terminus
xset +fp $HOME/.fonts/terminus
xmodmap $HOME/.Xmodmap
wbar &

exec jwm 2>&1 > $HOME/windowmanager.log
The commented lines are variations of the uncommented lines.

============

Also noticed my aliases in .profile don't seem to be working, but this may be an issue with a flaky remaster.
Title: Re: .xsession and .profile
Post by: ^thehatsrule^ on December 11, 2008, 12:52:57 PM
Afaik you need to background those (by appending & to every command)

---

You're talking about how they don't show up while in a X terminal emulator?

.profile is typically reserved for login shells only.  If you want to use your existing .profile each time, you can change your terminal emulator to always call a login shell, ie for aterm, change the invocation to `aterm -e sh --login`

The ash shell part of BusyBox does not have a dedicated interactive nonlogin startup source file.  If you prefer to use another file, you can set ENV to a file of your choice.

(edit: corrected to interactive)
Title: Re: .xsession and .profile
Post by: mikshaw on December 11, 2008, 04:26:18 PM
Again it seems to be my own dumb fault.  I booted a clean tinycore.gz (still with the added extensions), and those commands worked as expected from .xsession, so I must have broken something in my remaster.  Backgrounding is not necesary for xset, since it closes itself after it does its business.

On the subject of .profile, if what you say is true I don't understand why  there would already be aliases set in .profile in a default tinycore system.  I didn't think to check if my remaster caused that trouble, but I assume it was...I'll check again later.

I'm thinking of setting my shell to bash, since I already have it installed, and I'm much more comfortable with it than with other shells, but I think I need to reconsider how much I really need to do with a remaster.  I could just stick with adding reiserfs and do everything else from within my $HOME files as I did with DSL.
Title: Re: .xsession and .profile
Post by: ^thehatsrule^ on December 11, 2008, 05:20:23 PM
Did some testing, results may not be the same as others:
- using xset, etc. commands to the default .xsession works
- if using redirection on jwm, the extra commands only work with backgrounding
Seems a bit odd, but I wouldn't know how to explain it

I think those aliases were just defaults.  It'd be used on a VT, or ssh session, etc.

It would probably be better to use bash only as your interactive shell, and leave the rest for ash to handle because it's faster and lighter.
Title: Re: .xsession and .profile
Post by: mikshaw on December 11, 2008, 06:20:29 PM
Quote
if using redirection on jwm, the extra commands only work with backgrounding
I got dwm installed on tinycore , so I'll probably be using that now.
Side note: the latest version of dwm (5.3.1) doesn't build on Tinycore with the current extensions due to some addition that isn't supported by the Xorg headers (usegrab), but 5.2 works fine.

Quote
I think those aliases were just defaults.  It'd be used on a VT, or ssh session, etc.
I think your right.  My alias was mc='mc -b'.  When I was in the console, I seem to remember it wasn't that ugly blue it is when not using -b.  On the subject of mc, it told me in Tinycore console that I wasn't in a linux console or xterm, so the panels didn't toggle.  I seem to remember seeing this in DSL too, but for now I can't remember what I did to fix it.  Might require achange to inittab, but I'm planning to make some changes to that file anyway.
Title: Re: .xsession and .profile
Post by: hjkl on December 11, 2008, 07:27:14 PM
Hi mikshaw,
OT:
I also use dwm as my window manager.  I just compiled dwm(5.3.1) on TinyCore.

e8120aa61e855b59ec642dfef767e19f  tinycore_1.0rc3.iso
0e718639040e05ca7a3822f1a7d1163e  compiletc.tce
 tc@box[~]$ tce-load compiletc.tce

776970757181e3beb82a77054e2ded76  Xorg-7.4-dev-light.tce
 tc@box[~]$ tce-load Xorg-7.4-dev-light.tce

65b6eaa997984685887450885f5a36c6  dwm-5.3.1.tar.gz
 tc@box[~]$ tar -xvzf dwm-5.3.1.tar.gz
 tc@box[~]$ cd dwm-5.3.1
 tc@box[~/dwm-5.3.1]$ make

Enjoy!!
Title: Re: .xsession and .profile
Post by: mikshaw on December 12, 2008, 03:00:54 AM
Thanks for pointing me to Xorg-7.4-dev-light.  I'll definitely try that. 

OT:
I don't understand how a _smaller_ version of the same package would fix a problem with a missing function, but it's worth a try.   I thought the addition of usegrab in the latest dwm was the whole problem, but if you were able to build it using essentially the same headers, I'm guessing the blame is likely to be user error.  If you didn't need to modify  config.mk, I'm guessing dev-light might install into /usr/X11R6, which could be a significant difference.
The thing about staying updated with dwm is that it seems to be becoming less important to do so.  It's been consistantly stable since the developer stopped playing with whims near the beginning, and the last few updates seem to contain changes that have made little impact on me.  I'm guessing it will soon become "done", or as close to done as an open source project can be.  Either that or it's in danger of becoming something else, possibly suffering from whims once again.

EDIT:  ahhh....user error...again!  I think my brain has been leaking out my ears lately.  Instead of creating a new custom config.h using the latest config.def.h file as a base, I copied the one I had used for 5.2.  It turns out that usegrab is a new variable added to the dwm 5.3.1 config, and has nothing to do with Xlib =o)
Title: Re: .xsession and .profile
Post by: ^thehatsrule^ on December 12, 2008, 10:43:51 AM
The .info has some ... info:
Quote
Due to popular demand, now offering a headers-only version. By using this compiling might be easier, but you will also lack the advanced functionality.

Some of us had been requesting this because there were sometimes problems in using the full package due to it including more features, but usually had linking problems, etc.  If you do want the features, you could manually add to/fix the build commands, at least for now.
Title: Re: .xsession and .profile
Post by: mikshaw on December 12, 2008, 01:08:17 PM
Some answers....

The aliases were indeed not being used in aterm because .rofile isn't being read by a non-login shell.  I'm not sure how ash handles these shells, but when I changed my default shell to Bash and used my usual .bashrc and .bash_profile files, the aliases work.  It also fixed subshells in midnight commander.

Some of my other troubles seem to have been caused by a bad remaster.  I think when I first extracted tinycore.gz I used cpio -i without the other options listed in the wiki.  The last remaster I did works well (mostly).

There are still a couple of weird things happening, but I'm sure I'll find the problems soon enough...
The xmodmap command in .xsession doesn't seem to work if I exit to prompt and then use "startx" to return to the desktop...this seems bizarre to me at the moment, but it might be yet another thing I'm overlooking.
If I'm in aterm and use "sudo su", root retains my  environment.  There is no visual clue that I'm root.  If I use "sudo su -", I'm logged in a second time as tc. Ctrl+d logs out that new instance and I'm back to the original prompt.  I assumed "sudo su -" would start a root session with root's environment.  I have a workaround of sorts, a "sudo aterm"  command, and changing the prompt in .bashrc if $USER is root.
Quote
The ash shell part of BusyBox does not have a dedicated interactive startup source file.  If you prefer to use another file, you can set ENV to a file of your choice.
I overlooked this earlier.  Not knowing this is likely  the root of some of my confusion.
Title: Re: .xsession and .profile
Post by: ^thehatsrule^ on December 12, 2008, 01:41:27 PM
It could be something you've changed (again).  For me, using `sudo su ` shows the regular root@hostname:/current/path#
Maybe you'll need to add something for bash, like root's .bashrc ?

It is expected that using `sudo su - ` shows a regular tc user shell, due to how TC starts up: by autologging in as root first (see /etc/inittab), then changes the user to tc (see /root/.profile).  I'm not sure whether or not some other startup scripts depend on this setup though... wonder if it can be changed.
Title: Re: .xsession and .profile
Post by: mikshaw on December 12, 2008, 04:14:18 PM
Quote
Maybe you'll need to add something for bash, like root's .bashrc ?
I tried that, and got the same result.  After changing my shell to Bash, using "sudo su" in a terminal gives root the Bash shell as well, as you apparently guessed.  Maybe i'll need to give root a new PS1 from root's bash_profile.  In any case, the current setup I have gives root my environment, but I set root's PS1 from my .bashrc (if [ "$USER" == "root" ]), so it's a useable workaround.

Overall I'm mostly pleased with the results of today's work.  I'm almost as comfortable with TC as I am with DSL.  The potential TC has is much more flexible tha DSL, considering its very easy to install apps to /usr/local and everything is in standard directories.  On top of that, my persistent /usr/local means lower ram usage.
Title: Re: .xsession and .profile
Post by: mikshaw on February 16, 2009, 04:35:21 AM
Back to .xsession  (I took a break from TC until 1.1 was final)
I understand startx runs .xsession directly in order to remove a dependancy on xinit.  This means that Xvesa is also run directly, and backgrounded so that we can run xmodmap and xset and whatever else.  Maybe that backgrounding has something to do with my commands not being reliable, I don't know, but what I do know is that this setup leaves X running after all other applications close (including the window manager, if it's closed with its native quit function).  What I'm wondering is what does jwm, or more likely exittc, do when jwm is closed which also safely takes out X with it?  Is it simply killing the Xvesa process after jwm closes?
I'm guessing I can use wait $pid-of-dwm and then explicitly close Xvesa in .xsession.  Is that a sensible behavior?  Sounds like it should work, but I haven't tried it yet.
Also guessing Xorg extension includes xinit and a different startx script, so if I download that I'd end up with the behavior I'm accustomed to in other distros?
Title: Re: .xsession and .profile
Post by: curaga on February 16, 2009, 04:43:27 AM
The Xorg extension does not include xinit and it's own startx precisely not to mess with the script in the base ;)
Title: Re: .xsession and .profile
Post by: mikshaw on February 16, 2009, 05:26:30 AM
Okay, that's good to know.
So I'll try  te wait command in .xsession and see how that goes.
Still struggling with the other commands in .xsession...my keyboard-driven window manager relies on xmodmap in order to anything useful (it's configured to use both windows keys independently so as not to interfere with application hotkeys), and xset is wanted for aesthetic reasons (X fonts and wallpaper).  I have a feeling there is still something I broke, most likely something i'm overlooking in a /home/tc config file.

Also thinking seriously about using Bash only for interactive shells, as ^thehatsrule^ suggested.  I suppose that could be easily done by  changing aterm to use Bash automatically, and for all I know might also fix my issue with mc taking forever to start in tty.

Thanks again.
Title: Re: .xsession and .profile
Post by: roberts on February 16, 2009, 08:26:49 AM
Yes. In exittc, I am killing the Xserver.
Title: Re: .xsession and .profile
Post by: mikshaw on February 17, 2009, 12:23:48 PM
Thanks.  I'm now killing the Xvesa process after running the window manager (removed "exec")
Code: [Select]
Xvesa -br -mouse /dev/psaux,5 -screen 1024x768x32 -shadow -nolisten tcp -I >X.log 2>&1 &
xpid=$!
aterm -e tail -f $HOME/windowmanager.log $HOME/X.log &
sleep 1
xsri --color=\#000000 --color2=\#444444 --emblem=$HOME/image/paper/dwm-bg.png --emblem-alpha=120 --geometry=363x671+0-0
xmodmap $HOME/.Xmodmap
f=$HOME/.myfonts
xset b off +fp $f/artwiz,$f/lfp-fix,$f/proggy,$f/sgi,$f/terminus
dwm >windowmanager.log 2>&1
kill $xpid
I don't know for sure, but adding another command or two befor the xmodmap and xset commands seems to give it enough time to work.  It's fixed, so I'm not going to think about it any more for now.

I switched back to using Bash as my main shell, after discovering that the subshell inMidnight Commander apparently doesn't work if SHELL is ash.

Everything seems to be working as expected now. Next step is to try cramming all of compiletc and other things into /usr/local =o)

Thanks!
Title: Re: .xsession and .profile
Post by: tobiaus on February 19, 2009, 09:55:30 AM
ooh, does that mean you might create a mc extension? instead of listing bash as a dep, you could simply mention: "subshell features depend on gnu utils." i would be happy using it with ash, unless it's too weird or limited. (if it really is, maybe add bash as a dep.)
Title: Re: .xsession and .profile
Post by: mikshaw on February 19, 2009, 10:52:27 AM
Quote
does that mean you might create a mc extension?
If I can get it to work as well on TC as it does on my other distros, I probably will, including your suggestion for addressing the subshell issue.  I don't really care to deal with dependencies, at least for now, so I may not bother packaging anything that can't run on its own.  That would leave optional apps, such as Bash in the case of a Midnight Commander extension, in the hands of the user.  The subshell is the only thing I've noticed that is different between bash and ash, but the subshell is vital to me.

I just discovered last night that I have a new problem with mc related to audio.  I was testing OSS by playing mp3 files with mpg123 and mpg321 (to make sure the problem was not with mpg123) within mc.  When pressing Ctrl+c to quit the player (had to press it twice, for some reason), mc went back to its file listing as usual, but would not respond to any further input.   I had to force it to quit using the window manager.  There were no error messages, so I don't have a clue what's wrong right now.  It *might* have something to do with the fact that I also have the Alsa files installed, but haven't yet configured the system to use it (for some reason the setup script doesn't recognize my ES1371...a common soundblaster).  My next try I'll probably remove Alsa first and see if that helps.   Also haven't yet tested to see if it does the same with ogg123.  I'm thinking I might need to enable syslog if there is trouble outside the apps themselves.
EDIT: silly me.  I didn't notice that alsa_modules is a tcem...as with OSS.tcem I believe it needs to be loaded as an extension rather than simply extracted into my tclocal directory .  I guess I'll reboot and test it out again....

There's also still the weird issue of mc taking several seconds to start in tty.  I'm thinking there might be a permission problem, since it doesn't do this as root.  I had the same issue when using ash as SHELL, so Bash wasn't the problem.

I use Midnight Commander constantly...it's always open, sometimes two or three instances of it. It's one of my  must-have applications, so I have to make sure it is as good as can be if it's ever going to be an extension.
Title: Re: .xsession and .profile
Post by: tobiaus on February 19, 2009, 04:29:38 PM
oh take your time, i'd rather you submit an extension that you'd actually want to use. i don't care if it includes bash or not, it works better with it, but it sounds like for most purposes it's fine without it (people can always add it if they prefer.)
Title: Re: .xsession and .profile
Post by: mikshaw on February 20, 2009, 05:23:30 AM
This thread has become a TCE subject now, but I just wanted to post my progress on mc.

I tested the mpg321 binary from DSL along with the mc binary I'd built for DSL, and I got the same result, so I'm thinking the problem may have something to do with the way mc or the player interacts with the terminal specifically in TC.

Also found that using Ctrl+c to stop playback, and then Ctrl+d (instead of a second Ctrl+c) to return to the file list doesn't result in a broken mc (and subsequently the terminal itself after mc is forced to quit).  So I'm guessing mc doesn't get told that the process has finished, or maybe it doesn't finish by using Ctrl+c as it should, so it doesn't return to its file list until you manually send EOF signal.  The second Ctrl+c might have been killing a needed process.

There may be a configuration change I can make to .ashrc and .bashrc that will fix this, but I'm still fumbling in the dark at this point.
Title: Re: .xsession and .profile
Post by: tobiaus on February 20, 2009, 12:01:57 PM
you may solve your problems using mp3blaster instead of mpg123. naturally you'll have to create an extension for it first and use it in a backgrounded script... it also plays ogg files though. i tried mpg123 first when looking for a command line player. i like it, i didn't like ogg123. trying to squeeze this post in without making it more offtopic.
Title: Re: .xsession and .profile
Post by: mikshaw on February 20, 2009, 12:51:49 PM
I tried mp3blaster a couple years ago, but it seemed a little buggy...froze up a few times and often would not display the interface properly.  I use mocp a lot for interactive play, but still prefer mpg321 for playing single files. Besides that, using a different application only  ignores the trouble.  I'd like to fix the problem instead.  I have yet to install sox for wav playing, and to see if the same thing happens there...haven't got any ogg files on my harddrive as far as I can tell, so haven't tested ogg123 yet.  Oh...My UT2004 directory has some...i'll check that out a little later =o)
Once I install mplayer I can test that as well, since I believe it plays most audio files.

I read that the subshell in mc supports only bash, zsh, and tcsh, so that explains that part.  If you have ash set as the login shell and have bash installed, you can start mc with "SHELL=/usr/local/bin/bash mc" to use bash only for the subshell.  I'm not positive of this, though, since I already had bash added to /etc/shells...not sure if that is necessary.

More off topic...my remaster is quickly growing farther away from the point where I can boot into a vanilla TC system.  In fact I think it's already beyond that point...I think I'll need to have two copies of TC installed =op
Title: Re: .xsession and .profile
Post by: vyp08 on April 09, 2009, 09:52:42 PM
Good day!

I'm try use terminus fonts and get trouble with .xsession:

1. Boot from CD with tinycore_1.2.iso.
2. Download (from FTP) terminus fonts and unpack them to /usr/local/share/fonts/terminus.
3. In aterm run commands:
   xset +fp /usr/local/share/fonts/terminus/
   xlsfonts
All ok, I can see and use terminus fonts.
4. Add command "xset +fp /usr/local/share/fonts/terminus/" to ~/.xsession
    before "exec jwm".
5. pkill Xvesa.
6. startx
7. Run aterm and xlsfonts:
    no terminus fonts in out :(
Title: Re: .xsession and .profile
Post by: mikshaw on April 09, 2009, 10:20:04 PM
it might be as simple as removing the slash from the end of your font patyh, but that's just a guess.  So far I haven't had any trouble adding X fonts with xset.
Did you run mkfontdir in /usr/local/share/fonts/terminus?
Title: Re: .xsession and .profile
Post by: vyp08 on April 10, 2009, 12:49:43 AM
>it might be as simple as removing the slash
With '/' or without '/' - no difference.

Im too no have problem with adding fonts from running wm & aterm.

>Did you run mkfontdir in /usr/local/share/fonts/terminus?
No, file fonts.dir already exists and correct (some years ago).

PS. Im run TC on VMware.
Title: Re: .xsession and .profile
Post by: mikshaw on April 10, 2009, 09:05:03 AM
Quote
4. Add command "xset +fp /usr/local/share/fonts/terminus/" to ~/.xsession
    before "exec jwm".
5. pkill Xvesa.
6. startx
Keep in mind that teh x server has to be started before xset will work.  Sorry I didn't notice that earlier.
In .xsession, make sure the Xvesa line is before the xset line.
Title: Re: .xsession and .profile
Post by: vyp08 on April 12, 2009, 09:43:08 PM
$ cat .xsession
exec >/home/tc/X.log
exec 2>&1
set -x

DESKTOP="$(awk '/wm:/{print $2}' .desktop)"
Xvesa -br -mouse /dev/psaux,5 -screen 1024x768x32 -shadow -nolisten tcp -I 2>&1 > /dev/null &
xset +fp /usr/local/share/fonts/terminus
rc="$?";
echo "$0: xset return $?.";
n="`xlsfonts|grep terminus|wc|awk '{print($1)}'`";
echo "$0: founded Terminus fonts: $n."
exec "${DESKTOP:=jwm}"

$ cat X.log
+ awk /wm:/{print $2} .desktop
+ DESKTOP=jwm
+ Xvesa -br -mouse /dev/psaux,5 -screen 1024x768x32 -shadow -nolisten tcp -I 2>&1 > /dev/null &
(WW) Could not open RGB file "/usr/lib/X11/rgb.txt"; will use built-in copy.
+ xset +fp /usr/local/share/fonts/terminus
Could not init font path element /usr/lib/X11/fonts/TTF/, removing from list!
Could not init font path element /usr/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/lib/X11/fonts/Type1/, removing from list!
Could not init font path element /usr/lib/X11/fonts/CID/, removing from list!
Could not init font path element /usr/lib/X11/fonts/100dpi/, removing from list!
+ rc=0
+ echo /home/tc/.xsession: xset return 0.
/home/tc/.xsession: xset return 0.
+ xlsfonts
+ grep terminus
+ wc
+ awk {print($1)}
Could not init font path element /usr/lib/X11/fonts/TTF/, removing from list!
Could not init font path element /usr/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/lib/X11/fonts/Type1/, removing from list!
Could not init font path element /usr/lib/X11/fonts/CID/, removing from list!
Could not init font path element /usr/lib/X11/fonts/100dpi/, removing from list!
+ n=0
+ echo /home/tc/.xsession: founded Terminus fonts: 0.
/home/tc/.xsession: founded Terminus fonts: 0.
+ exec jwm
Could not init font path element /usr/lib/X11/fonts/TTF/, removing from list!
Could not init font path element /usr/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/lib/X11/fonts/Type1/, removing from list!
Could not init font path element /usr/lib/X11/fonts/CID/, removing from list!
Could not init font path element /usr/lib/X11/fonts/100dpi/, removing from list!
JWM: warning: /home/tc/.jwmrc[31]: invalid entity: "&& imlib"
JWM: warning: /home/tc/.jwmrc[31]: invalid entity: "& imlib2"
Using /home/tc/.wbar config file.
Using a Super Bar.
Title: Re: .xsession and .profile
Post by: mikshaw on April 13, 2009, 06:52:10 AM
Might be the same problem I was having.  Try adding "sleep 1" after the Xvesa line.  This is not usually required, but tc doesn't run X in the usual way.  It seems like pausing for a second before running xset gives Xvesa a better chance to start up.

I'm curious what those first three lines are
Code: [Select]
exec >/home/tc/X.log
exec 2>&1
set -x
Title: Re: .xsession and .profile
Post by: vyp08 on April 13, 2009, 10:14:38 PM
1.
I'm already add sleep 1|10|20 - no difference.

2.
>I'm curious what those first three lines are
For this three lines busybox(ash) == bash == POSIX shell.

exec >/home/tc/X.log
  redirect standard output to file ~/X.log

exec 2>&1
  redirect standard error to standard output, i.e. to file ~/X.log
About redirect see man bash, REDIRECTION, line 1590 (GNU bash, version 3.2.39(1)-release (i386-redhat-linux-gnu))

set -x
  man bash, line 4380 (GNU bash, version 3.2.39(1)-release (i386-redhat-linux-gnu))
[.. skip ..]
-x      After expanding each simple command, for command, case command, select command,  or
              arithmetic  for command, display the expanded value of PS4, followed by the command
              and its expanded arguments or associated word list.
[.. skip ..]

3.
.xsession work fine now :)

$ cat .xsession
exec >/home/tc/X.log
exec 2>&1
set -x
DESKTOP="$(awk '/wm:/{print $2}' .desktop)"
Xvesa -br -mouse /dev/psaux,5 -screen 1024x768x32 -shadow -nolisten tcp -I 2>&1 > /dev/null &
jwm&
#aterm&
xset +fp /usr/local/share/fonts/terminus
rc="$?";
echo "$0: xset return $?.";
n="`xlsfonts|grep terminus|wc|awk '{print($1)}'`";
echo "$0: founded Terminus fonts: $n."
#jwm
#aterm&
sleep 4294967295

Fonts added correct, if xset is AFTER jwm&|aterm&|...
Its a magic :) !
Title: Re: .xsession and .profile
Post by: vyp08 on April 14, 2009, 12:13:12 AM
In version 1.3 .xsession work from box. Thanks!
Title: Re: .xsession and .profile
Post by: mikshaw on April 14, 2009, 07:17:48 AM
Quote
$ help exec
exec: exec [-cl] [-a name] file [redirection ...]
    Exec FILE, replacing this shell with the specified program.
    If FILE is not specified, the redirections take effect in this
    shell.
  If the first argument is `-l', then place a dash in the
    zeroth arg passed to FILE, as login does.  If the `-c' option
    is supplied, FILE is executed with a null environment.  The `-a'
    option means to make set argv[0] of the executed process to NAME.
    If the file cannot be executed and the shell is not interactive,
    then the shell exits, unless the shell option `execfail' is set.
I wasn't aware that you could use exec this way.  Thanks.