--- a/src/bin/keactrl/keactrl.in
+++ b/src/bin/keactrl/keactrl.in
@@ -98,7 +98,7 @@ get_pid_from_file() {
     # Extract the name portion (from last slash to last dot) of the config file name
     # File name and extension are documented in src/lib/util/filename.h
     local conf_name
-    conf_name=$(basename -- "${kea_config_file}" | rev | cut -f2- -d'.' | rev)
+    conf_name=$(basename -- "${kea_config_file}" | awk '{for(i=length($0); i>0;i--) printf (substr($0,i,1));}' | cut -f2- -d'.' | awk '{for(i=length($0); i>0;i--) printf (substr($0,i,1));}')
 
     # Default the directory to --localstatedir / run
     local pid_file_dir
