• Welcome to Bashguru

    Linux is one of popular version of UNIX operating System. It is open source as its source code is freely available. It is free to use. Linux was designed considering UNIX compatibility. It's functionality list is quite similar to that of UNIX and become very popular over the last several years. Our Basic motive is to provide latest information about Linux Operating system.

  • Python Programming

    Python is a comparatively simple programming language, compared to c++. Although some of the benefits of c++ are abstracted away in python, they are replaced with an overall easier to learn language with many “intuitive” features. For this reason it is common and recommended by most professionals that people new to programming start with python.

  • Perl Programming

    Perl is an open-source, general-purpose interpreted programming language. Used often for CGI, Perl is also used for graphics programming, system administration, network programming, finance, bioinformatics, and other applications. The Perl languages borrow features from other programming languages including C, shell scripting (sh), AWK, and sed. They provide powerful text processing facilities without the arbitrary data-length limits of many contemporary UNIX command line tools, facilitating easy manipulation of text files.

  • Android

    Android is an operating system based on the Linux kernel, and designed primarily for touch screen mobile devices such as smart phones and tablet computers. Android is a Linux-based software system, and similar to Linux, is free and open source software. This means that other companies can use the Android operating developed by Google and use it in their mobile devices.Android gives you a world-class platform for creating apps and games for Android users everywhere, as well as an open marketplace for distributing to them instantly.

Saturday, September 19, 2009

Posted by venu k
58 comments | 10:33 AM

# isuserloggedin.sh
# Usage: isuserloggedin.sh username
# Shell script which checks after every one minute whether a user has logged in
# or not
# You can also run script in background using & then foreground it to view result

if [ $# -ne 1 ]
echo "You supplied wrong arguments"
echo "usage : `basename $0` username"
exit 1

grep -w "$1" /etc/passwd > /dev/null

if [ $? -eq 1 ]
echo "$1 is not a valid user"
exit 1

isuserexist $1
while true
# you can replace following two statements with
# if `who|grep $1 > /dev/null`
who|grep $1 > /dev/null
if [ $? -eq 0 ]
echo "User $1 is logged in "
if [ $time -gt 60 ]
echo "He is logged in $hours hour(s) $minutes minute(s) late"
echo "He is logged in $time minute(s) late"
exit 0

let time++

# You can use following formats also
# time=`expr $time + 1 `
# time=$((time+1))

sleep 60

[root@localhost shell]# sh isuserloggedin.sh
you have suplied wrong arguments
usage : isuserloggedin.sh username
[root@localhost shell]# sh isuserloggedin.sh root
User root is logged in
He is logged in 0 minute(s) late
[root@localhost shell]# sh isuserloggedin.sh roott
roott is not a valid user
Run script in background
[root@localhost shell]# sh isuserloggedin.sh venu &
[1] 15917
[root@localhost shell]# User venu is logged in
He is logged in 3 minute(s) late

[1]+ Done sh isuserloggedin.sh venu
Run script in background then foreground it
[root@localhost shell]# sh isuserloggedin.sh venu &
[1] 16223
[root@localhost shell]# fg
sh isuserloggedin.sh venu
User venu is logged in
He is logged in 1 minute(s) late
[root@localhost shell]#


  1. There are lots of information about latest technology and how to get trained in them, like UNIX Training have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies(UNIX Training Institutes in Chennai). By the way you are running a great blog. Thanks for sharing this.

    UNIX Training | UNIX Training Institutes in Chennai

    1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training India . Nowadays Java has tons of job opportunities on various vertical industry.

  2. Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
    digital marketing course in Chennai | digital marketing training in Chennai

  3. • such a good website and given to more information thanks! and more visit.
    selenium training in chennai

  4. Thanks for sharing this valuable articles - Best QTP Training in Chennai
    Try it Yourself »

  5. Extremely enlightening substance. Digital marketing is the best to promote our product. We mainly focus on SMO and SEO in digital marketing. The main task is to analyze the keyword and to bring the site at the top position for particular keyword.
    Digital Marketing Training in Chennai | Digital Marketing Chennai | Digital Marketing courses in Chennai

  6. I have read your blog its very Interesting. Thanks for sharing. ERP Providers in Chennai | ERP in Chennai. We provide best quality cost effective ERP software applications and end to end enterprise solutions to all the industry verticals with the affordable cost.

  7. Thank you for this valuable information. I have got some important suggestions from it. Get your business to the next level in simple steps.
    ERP in Chennai

  8. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android training in chennai

  9. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Ios training in chennai

  10. http://sysacd.in/portfolio-view/red-hat-linux-training-in-chennai/

  11. I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one.

    Webdesign Lüdenscheid

  12. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.

    Java Training In Bangalore

  13. Interesting post! This is really helpful for me. I like it! Thanks for sharing!
    online marketing lüdenscheid

  14. The website is looking bit flashy and it catches the visitors eyes. A design is pretty simple .
    online marketing lüdenscheid

  15. Thank you a bunch for sharing this with all of us you really understand what you are speaking about! Bookmarked. Please additionally seek advice from my website =). We can have a link trade arrangement among us!

  16. Thanks for sharing amazing information !!!!!!
    Please keep up sharing.

  17. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    Best Hadoop Training Institute In chennai

  18. Some us know all relating to the compelling medium you present powerful steps on this.Advanced Selenium Training in Chennai

  19. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    aws training in Chennai

  20. Best Mobility ServicesVery good informative article. Thanks for sharing such nice article, keep on up dating such good articles.

  21. I and my friends were going through the nice, helpful tips from the blog then the sudden came up with an awful suspicion I never expressed respect to the website owner for those secrets.

  22. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site. JAVA Training in chennai

  23. I simply wanted to thank you so much again. I am not sure the things that I might have gone through without the type of hints revealed by you regarding that situation.
    Best selenium training Institute in chennai

  24. Madhuvahini Houseboat Service is the new initiative being launched by Malabar tourism management @ Bekal, Nileshwar, Kasaragod, Kannur, Calicut, Manglore. 1HR, 2HR, Sunset, Dinner, Overnight, Day Night Cruise Available. Life is Better on Boats to explore the area of backwaters and offer Kerala traditional Home and Boat Stay Service.

  25. Yiioverflow presenting one of the best and high performance PHP framework. Fast, secure and extremely professionals are developing applications. We guide to implement mobile app development and SOA hybrid applications.Code in Nodejs, Angular,Ionic,ReactJS and Yiiframework.