Re: How to check the number of terminals open from inside a shell script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29Oct2010 09:52, suvayu ali <fatkasuvayu+linux@xxxxxxxxx> wrote:
| On 29 October 2010 06:39, Mark Liggett <mliggett@xxxxxxxxxxxxxx> wrote:
| > You could add your script to the .bashrc file – this way the script would
| > run once when the user logs on.
| 
| I presume you meant ~/.bash_profile ? ~/.bashrc is sourced every time
| a user opens a terminal, whereas ~/.bash_profile is sourced every time
| a user logs in. This distinction however becomes redundant when the
| user always uses a text terminal to login. (as in no gui)

Not if they run a subshell. For example, a shell escape from an editor,
or a screen session, or ...

The number of bugs in the .bashrc suggestion is high. $ signs, dahses
instead of underscores, .bashrc instead of .bash_profile, presuming the
user users bash at all (I don't if I can help it, myself - zsh has
better facilities), not working at all anyway, since another login
wouldn't see the exported variable anyway, not actually looking at
terminals at all...

But the OP needs to clarify what he/she means by "number of open
terminals" (for this user? only showing in "who"? or other terminals?
etc) and whether that is actaully what they need or just what they
think _indicates_ what they actually need.

What he/she actually asks for is difficult to do properly. Hopefully it isn't
what they need.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

My motto is, 'Do it my way or watch your butt.' -  Nathan Arizona
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux