I need to verify that the / etc / passwd file is valid, and thought that regex would be a good idea for checking lines that are not comments. How to check a string, for example:
root:*:0:0:System Administrator:/var/root:/bin/sh
After some research, the fifth field (system administrator) may contain other data, such as email address and address, the second field may contain everything except the :last 2 fields are full paths.
Any clues how could I create a regex expression for this?
source
share