Bash script opening application

In this tutorial, I have written a small program opening application by the shell script. Linux the essential for DevOps Roles.
I will create the directory and create a file openapp. Let’s begin!

[huupv@huupv devopsroles]$ mkdir myall && cd $_
[huupv@huupv myall]$ pwd
/home/huupv/devopsroles/myall
[huupv@huupv myall]$ touch openapp

My openapp with the bash script

#!/bin/bash

if [ $1 = "fb" ]; then
  echo Opening facebook
  python -m webbrowser -t "https://www.facebook.com/"
elif [ $1 = "web" ]; then
  echo Opening My Website 
  python -m webbrowser -t "https://www.devopsroles.com/"
  python -m webbrowser -t "https://www.huuphan.com/"
elif [ $1 = "youtube" ]; then
  echo Opening youtube
  python -m webbrowser -t "https://www.youtube.com/user/SystemOperatinglinux"
fi

Add permission to execute.

[huupv@huupv myall]$ chmod +x openapp

Now, I opening Youtube with my shell script.

[huupv@huupv myall]$ ./openapp youtube

The screen output terminal as below

Bash script opening application

Conclusion

Thought the article, How to use Bash script opening application as above. I hope will this your helpful.

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.