Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1052)

Unified Diff: src/scripts/common.sh

Issue 1610021: Add sudo_clobber and sudo_append functions so that we can "echo" (Closed)
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/common.sh
diff --git a/src/scripts/common.sh b/src/scripts/common.sh
index f75fa6b1301dc994d0eab7faa268ea1d3e8348f1..c5ae10413238823a0ce78a38a855839bc14455e9 100644
--- a/src/scripts/common.sh
+++ b/src/scripts/common.sh
@@ -149,8 +149,8 @@ esac
# Functions
function setup_board_warning {
- echo
- echo "$V_REVERSE================= WARNING ======================$V_VIDOFF"
+ echo
+ echo "$V_REVERSE================= WARNING ======================$V_VIDOFF"
echo
echo "*** No default board detected in " \
"$GCLIENT_ROOT/src/scripts/.default_board"
@@ -162,8 +162,8 @@ function setup_board_warning {
# Sets the default board variable for calling script
function get_default_board {
- DEFAULT_BOARD=
-
+ DEFAULT_BOARD=
+
if [ -f "$GCLIENT_ROOT/src/scripts/.default_board" ] ; then
DEFAULT_BOARD=`cat "$GCLIENT_ROOT/src/scripts/.default_board"`
fi
@@ -323,3 +323,17 @@ function eretry () {
function remove_quotes() {
echo "$1" | sed -e "s/^'//; s/'$//"
}
+
+# Writes stdin to the given file name as root using sudo in overwrite mode.
+#
+# $1 - The output file name.
+function sudo_clobber() {
+ sudo tee "$1" > /dev/null
+}
+
+# Writes stdin to the given file name as root using sudo in append mode.
+#
+# $1 - The output file name.
+function sudo_append() {
+ sudo tee -a "$1" > /dev/null
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698