Bash script as root problem

Gene Heskett gheskett at wdtv.com
Sun Mar 17 00:17:54 UTC 2013


On Saturday 16 March 2013 20:15:40 Johnny Rosenberg did opine:

> I have a bash script that I am going to run as root (sudo
> script_name), but in that script there is a line that I want to be
> executed as a regular user. Is that possible or do I need to do it the
> other way around, that is enter sudo at the beginning of every line
> except the one that I need to be run as a user?
> 
> 
> Johnny Rosenberg
Run the script as root, and when you get to that line, edit it so it lookls 
like this:

su username -c "that line as it exists now in your script"

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
My views 
<http://www.armchairpatriot.com/What%20Has%20America%20Become.shtml>
The bland leadeth the bland and they both shall fall into the kitsch.
I was taught to respect my elders, but its getting 
harder and harder to find any...




More information about the ubuntu-users mailing list