Re: redirecting out of a command invoked by sudo fails

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

 




On 06/25/2010 02:51 PM, Greg Woods was caught red-handed while writing::
> On Fri, 2010-06-25 at 12:33 -0700, JD wrote:
>    
>> On 06/25/2010 12:04 PM, Bill Crawford was caught red-handed while writing::
>>      
>>> On 25 June 2010 19:38, JD<jd1008@xxxxxxxxx>   wrote:
>>>
>>>        
>>>> cd /var/lib
>>>> sudo tar cjf - rpm>   rpm.tar.bz2
>>>> sh: rpm.tar.bz2: cannot create [Permission denied]
>>>>          
>>   sudo only runs the "tar" command; the redirect (>) is
>>      
>>> done by the shell, and since you aren't root, you can't write in
>>> /var/lib.
>>>        
> The classic example to illustrate this is:
>
> $ cat a b>  a
>
> This is supposed to append b to a, but what actually happens is that the
> redirection truncates a first, and you wind up with a copy of b in a and
> the original contents of a are lost (do not ask how I learned this; the
> answer is "the hard way" )-:
>
> $ cat b>>  a
>
> is the right way to do that.
>
> In both of these cases, the problem is that the shell does the
> redirection first before executing the commands.
>
> --Greg
>
>
>    
As I have already answered, let'ts not beat a dead horse.
Issue already very well explained by Bill Crawford.
No need for any followups.
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux