18 lines
319 B
Plaintext
Executable File
18 lines
319 B
Plaintext
Executable File
#!/usr/bin/env nix-shell
|
|
#!nix-shell -i bash -p bash -p coreutils-full
|
|
|
|
# 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
|