some bash help

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Bill Jonas
Date:  
Subject: some bash help
--LDKKMwhyHHnvsTPO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Feb 28, 2003 at 04:07:38PM -0700, BoBB wrote:
> if [ $SPLASH ]
> then
>         [ -f /proc/splash ] && \
>         # switch to a usable image on all consoles \
>         for TTY in `/usr/bin/seq 0 5`; \
>                 do /usr/bin/splash -s -u $TTY /usr/share/bootsplash-0.4/console=

.cfg; \
>         done; \
>     export SPLASH=3D""
> fi


$SPLASH only gets set in the user's login shell's environment.

Think of it this way: init is the parent of a getty, which runs the
login program, which executes your shell if it's satisfied that you
belong on the system (ie, you give it a valid username and password
combination). Your shell runs, sources /etc/profile (and your personal
=2Eprofile or .bash_profile), which has commands that set up your
environment. In the mean time, the getty/login instances running on
other virtual consoles are unaffected by the change of environment in
this one shell, and init (which respawns the getty when you log out and
your shell exits) isn't either.

Perhaps a better way to do it would be to create a file upon login. If
there will be other users on the system, this could get a little ugly,
as /tmp and /var/tmp have the sticky bit set, thus denying users the
privilege of deleting files created by other users.

In any case, that's why it doesn't work.

> #!/bin/bash
> if [ $SPLASH ]
> then
>         echo works
> fi
> =09
> and it works as expected, export SPLASH=3D"" causes it to do nothing,
> export SPLASH=3D"yes" prints 'works' anyone have any ideas?


$SPLASH, again, is only affected in your one particular login
environment by the things you do in that environment. So yes, that
script will work as expected when started by hand.

I'd suggest either touching /var/tmp/splash and removing it when you log
out, or making that file world-writable and writing a value to it.
(Perhaps you could do something like "num=3D`cat /var/tmp/splash`; echo
$[$num+1] >/var/tmp/splash" and do $num-1 upon logout. That way you
could see how many users are logged in. Just an idea.

--=20
Bill Jonas    *        *    http://www.billjonas.com/
"It's a dangerous business, Frodo, going out your front door.  You step
into the Road,  and if you don't keep your feet,  there  is  no knowing
where you might be swept off to."  --  Bilbo Baggins


--LDKKMwhyHHnvsTPO
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+YNLvdmHcUxFvDL0RApAHAJoDDc/4zKMMmtBcUTPCuFLMZ17lpQCggKJg
L8jP0AW2zJDrdAVlDo43Gvk=
=ko9I
-----END PGP SIGNATURE-----

--LDKKMwhyHHnvsTPO--