4 ms·
No, you should use sudo sh -c "cat foobar.img > /dev/sdi" or sudo -s "cat foobar.img > /dev/sdi"
by sply 10y ago
No, you should use
sudo sh -c "cat foobar.img > /dev/sdi"
or
sudo -s "cat foobar.img > /dev/sdi"
- RJIb8RBYxzAMX9u 10y agoI was originally going to put that in my examples, but opted to leave it out, because with sh -c you have to think about escaping special characters. Most of the time it doesn't matter, but when running commands as root you ought to be absolutely sure.
- nerdponx 10y agoWhat about using a here-doc (as in http://stackoverflow.com/a/16514624/2954547 http://stackoverflow.com/a/16514624/2954547)? sudo sh <<EOF cat foobar.img > /dev/sdi EOF
- deleted 10y ago[deleted]