[sf-lug] Fwd: [UMALUG] bash scripting question

Kristian Erik Hermansen kristian.hermansen at gmail.com
Sat Mar 1 22:42:26 PST 2008

Can someone explain why removing the EOFs here breaks the script when
using sudo?

---------- Forwarded message ----------
From: Tyler Trafford <ttrafford at gmail.com>
Date: Sun, 02 Mar 2008 00:23:33 -0500
Subject: Re: [UMALUG] bash scripting question
To: Linux Users Group <umasslug at ecs.umass.edu>

Tyler Trafford wrote:
> I have a script with a problem: it runs fine, except when I run it with
> sudo.  I can't figure out why that is.
> Here's a simple example that demonstrates my problem:
> -mytest.sh-
> #!/bin/bash
> vimdiff ~/.bashrc <(whoami)
> ---

It's odd, but changing the script like so:


/bin/bash << EOF
vimdiff ~/.bashrc <(whoami)

-makes it work with and without sudo.  I'd still like to know why if
anyone has an idea.
Tyler Trafford

A sect or party is an elegant incognito devised to save a man from
the vexation of thinking.
		-- Ralph Waldo Emerson, Journals, 1831
UmassLUG mailing list
UmassLUG at ecs.umass.edu

Sent from Gmail for mobile | mobile.google.com

Kristian Erik Hermansen
"It has been just so in all my inventions. The first step is an
intuition--and comes with a burst, then difficulties arise. This thing
gives out and then that--'Bugs'--as such little faults and
difficulties are called--show themselves and months of anxious
watching, study and labor are requisite before commercial success--or
failure--is certainly reached" -- Thomas Edison in a letter to
Theodore Puskas on November 18, 1878

More information about the sf-lug mailing list