Fix sed invocations for OSX

This commit is contained in:
Victor Borja 2017-09-03 20:23:06 -05:00
parent f23b448c0c
commit 5398d8949c
2 changed files with 3 additions and 3 deletions

View File

@ -51,7 +51,7 @@ write_shim_script() {
cp "$plugin_shims_path/$executable_name" "$shim_path" cp "$plugin_shims_path/$executable_name" "$shim_path"
elif [ -f "$shim_path" ]; then elif [ -f "$shim_path" ]; then
if ! grep "# asdf-plugin-version: $version" "$shim_path" > /dev/null; then if ! grep "# asdf-plugin-version: $version" "$shim_path" > /dev/null; then
sed "$shim_path" -i'' -e "s/\(asdf-plugin: $plugin_name\)/\1\n# asdf-plugin-version: $version/" sed -i'' -e "s/\(asdf-plugin: $plugin_name\)/\1\\"$'\n'"# asdf-plugin-version: $version/" "$shim_path"
fi fi
else else
cat <<EOF > "$shim_path" cat <<EOF > "$shim_path"
@ -191,7 +191,7 @@ remove_shim_for_version() {
return 0 return 0
fi fi
sed "$shim_path" -i'' -e "/# asdf-plugin-version: $version/d" sed -i'' -e "/# asdf-plugin-version: $version/d" "$shim_path"
if [ ! -f "$plugin_shims_path/$executable_name" ] && \ if [ ! -f "$plugin_shims_path/$executable_name" ] && \
! grep "# asdf-plugin-version" "$shim_path" > /dev/null || \ ! grep "# asdf-plugin-version" "$shim_path" > /dev/null || \

View File

@ -69,7 +69,7 @@ teardown() {
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
lines_count=$(grep "asdf-plugin-version: 1.1" $ASDF_DIR/shims/dummy | wc -l) lines_count=$(grep "asdf-plugin-version: 1.1" $ASDF_DIR/shims/dummy | wc -l)
[ "$lines_count" = "1" ] [ "$lines_count" -eq "1" ]
} }