I'm running CentOS 6.8 and use bash. I would like a warning to appear to the user who runs the command "service httpd restart"
E.g.
# service httpd restart
are you sure y/n
n
#
(or if y, the command executes).
I looked into it a little but am not sure of the best approach. Aliases I believe are only one word, maybe aliasing the existing 'service' to a script which checks for the 'httpd restart' arguments?
I read shell functions are preferred over aliases, could a shell function do this? I wasn't sure if the shell function went in .bashrc and also needed an alias to work?
I also
read something about precmd() and preexec() functionality for bash, but wasn't sure if that would be required, or work, for this case?
Thanks for any info,
sg