0
1
If I wanted to do something like
sudo fdisk -l > test.txt
but I wanted test.txt to be under my own user ID (and not root) without having to chown it afterwards, is there a way to do this?
Specifically my actual goal is to have a python script perform a bunch of sudo-permission operations, and dump the outputs. In what way should I ask for sudo permissions if the flow is something like:
somescripts
\-> runs python script, grabs sudo
\-> runs operation with sudo permissions
| like fdisk -l > test.txt
\-> runs operation with sudo permissions, reads stdout, writes stdout to file
like fdisk -l --> reads stdout --> make file --> writes data to file
Thank you.