sane-scripts: new helper to redirect stdout to some permissioned file
This commit is contained in:
parent
d54b595e45
commit
e2985ef018
16
pkgs/sane-scripts/src/sane-sudo-redirect
Executable file
16
pkgs/sane-scripts/src/sane-sudo-redirect
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# redirects to $1, when writing to $1 requires sudo permissions.
|
||||||
|
# i.e. convert a failing command:
|
||||||
|
#
|
||||||
|
# ```
|
||||||
|
# $ sudo do_thing > /into/file
|
||||||
|
# ```
|
||||||
|
#
|
||||||
|
# to
|
||||||
|
#
|
||||||
|
# ```
|
||||||
|
# $ sudo do_thing | sane-sudo-redirect /into/file
|
||||||
|
# ```
|
||||||
|
|
||||||
|
exec sudo tee $@ > /dev/null
|
Loading…
Reference in New Issue
Block a user