[sudo-users] Syntax of -i option

Martin Belanger martin.belanger at cyaninc.com
Fri Feb 17 18:40:54 EST 2012

I wrote a bash script that uses "sudo -i [command]".  This script works
fine with sudo version 1.7.4p6.  However, it fails when using sudo version

I found that for version 1.7.2p1 the [command] has to be enclosed in
With version 1.7.4p6, [command] must not be enclosed in quotes.

Do you have any recommendations on how to write a portable script that will
handle both syntax?

I made it work by trying both syntax and checking which one returns
error-free.  Just wondering if there is a more elegant way.


More information about the sudo-users mailing list