Nk_list_all_domains

Home

Description

In this bash function, the command awk is used to print the first field in /etc/userdomains by using “:” as a delimiter, and then grep is used to remove any lines that start with a wildcard character. The resulting output is a list of all the domains.

Example

[root@cloudvpsserver ~]# nk_list_all_domains
domain.com
example.com

Code

nk_list_all_domains() {
# print out the first field in /etc/userdomains by using : to split. Then remove anything that starts with a wild card.
awk -F ":" '{print $1}' /etc/userdatadomains | grep -vE "^\*"
}

Author: Nichole Kernreicht

Created: 2023-04-09 Sun 21:15