On Wed, 27 Feb 2019, Rich Shepard wrote:

On Wed, 27 Feb 2019, Rich Shepard wrote:

 Can I set an alias so when she exits X11 to a console all she needs to
 type
 is
 sudo halt
 and this will invoke /sbin/shutdown -h now? Gotta' keep in simple here.

Saw a web blog post that suggests I if add to her ~/.bash_rc the following
alias

alias halt='alias=`sudo ` halt'

all she'd need to type is halt. Does this look workable?

My experience is that sudo expects the command line invocation to look like the sudo configuration. So what I'd do is add a function, not an alias, to .bashrc:

function halt {
  /sbin/shutdown -h now
}

But since "halt" is the name of an actual executable, maybe train her to use something like "haltnow" and tweak the name of the function:

function haltnow {
  /sbin/shutdown -h now
}

--
Paul Heinlein
[email protected]
45°38' N, 122°6' W
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to