Navigation Menu

Skip to content

Commit

Permalink
Fixed sed to work on Linux and other (by which we mean OSX)
Browse files Browse the repository at this point in the history
  • Loading branch information
srstrong committed Mar 18, 2015
1 parent 426baf1 commit 4b2eb6d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vir
Expand Up @@ -10,6 +10,7 @@ munge_file() {
local variable=$2
local value=$3
local MATCH="s/\$$variable/$value/g"

mv $file $(echo $file | sed $MATCH)
}

Expand All @@ -35,8 +36,12 @@ template_files() {

for file in ${files[@]}
do
if [[ -f $file ]]; then
sed -i "$MATCH" $file
if [[ -f $file ]]; then
if [[ $(uname) == "Linux" ]]; then
sed -i "$MATCH" $file
else
sed -i "" "$MATCH" $file
fi
fi
done
}
Expand Down

0 comments on commit 4b2eb6d

Please sign in to comment.