How To Install shflags on CentOS 7

In this tutorial we learn how to install shflags on CentOS 7. shflags is Simple handling of command-line flags in Bourne based Unix scripts

Introduction

In this tutorial we learn how to install shflags on CentOS 7.

What is shflags

Shell Flags (shFlags) is a library written to greatly simplify the handling of command-line flags in Bourne based Unix shell scripts (bash, dash, ksh, sh, zsh) on many Unix OSes (Linux, Solaris, Mac OS X, etc.). Most shell scripts use getopt for flags processing, but the different versions of getopt on various OSes make writing portable shell scripts difficult. shFlags instead provides an API that doesn’t change across shell and OS versions so the script writer can be confident that the script will work. shFlags is a port of the google-gflags C++/Python library.

We can use yum or dnf to install shflags on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install shflags.

Install shflags on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install shflags using yum by running the following command:

sudo yum -y install shflags

Install shflags on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install shflags using dnf by running the following command:

sudo dnf -y install shflags

How To Uninstall shflags on CentOS 7

To uninstall only the shflags package we can use the following command:

sudo dnf remove shflags

References

Summary

In this tutorial we learn how to install shflags on CentOS 7 using yum and dnf.