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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux