Created
July 19, 2016 10:01
-
-
Save nishinoshake/fee2fd3150dc496aa8434ea610a0dd81 to your computer and use it in GitHub Desktop.
sudoをパイプやリダイレクトに効かせる
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ふつうにsudoしてリダイレクトすると | |
# コマンドに対してしかsudoしない | |
sudo ls > ls.txt | |
# コマンドをshでラップしてshにsudoすれば全体に効く | |
# 読みにくいけど | |
sudo sh -c "ls > ls.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment