bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: funsub questions


From: Greg Wooledge
Subject: Re: funsub questions
Date: Wed, 13 Dec 2023 23:05:13 -0500

On Wed, Dec 13, 2023 at 10:48:59PM -0500, Zachary Santer wrote:
> On Wed, Dec 13, 2023 at 9:17 PM Greg Wooledge <greg@wooledge.org> wrote:
> > If you'd like to read the contents of a file into a variable, the
> > "read" and "readarray" (aka "mapfile") builtins are usually better
> > choices anyway.  $(< file) would only be useful if you want the entire
> > content in a single string variable, which is a questionable idea in
> > most programs.
> sudo kill -s SIGHUP "$(< /var/run/sshd.pid)"
> The one thing I've done with this that wasn't a bad idea.

Is that on a system that lacks a process manager?  Something like
"systemctl reload ssh" or "service ssh reload" would be preferred from
a system admin POV, on systems that have process managers.

And before bash 5.2,

    read -r pid < /var/run/sshd.pid && sudo kill -s SIGHUP "$pid"

would be more efficient, on systems where no process manager is in use.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]