mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Tell sed to create backup files, and the remove them
This seems like the easiest way forward, considering the incompatability between the LInux and MacOS versions of sed.
This commit is contained in:
parent
dc3865c9fd
commit
43fd8c978d
@ -58,7 +58,8 @@ write_shim_script() {
|
||||
cp "$plugin_shims_path/$executable_name" "$shim_path"
|
||||
elif [ -f "$shim_path" ]; then
|
||||
if ! grep "# asdf-plugin-version: $version" "$shim_path" > /dev/null; then
|
||||
sed -i '' -e "s/\(asdf-plugin: $plugin_name\)/\1\\"$'\n'"# asdf-plugin-version: $version/" "$shim_path"
|
||||
sed -i.bak -e "s/\(asdf-plugin: $plugin_name\)/\1\\"$'\n'"# asdf-plugin-version: $version/" "$shim_path"
|
||||
rm "$shim_path".bak
|
||||
fi
|
||||
else
|
||||
cat <<EOF > "$shim_path"
|
||||
@ -210,7 +211,8 @@ remove_shim_for_version() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
sed -i '' -e "/# asdf-plugin-version: $version/d" "$shim_path"
|
||||
sed -i.bak -e "/# asdf-plugin-version: $version/d" "$shim_path"
|
||||
rm "$shim_path".bak
|
||||
|
||||
if [ ! -f "$plugin_shims_path/$executable_name" ] && \
|
||||
! grep "# asdf-plugin-version" "$shim_path" > /dev/null || \
|
||||
|
@ -25,7 +25,8 @@ version_command() {
|
||||
done
|
||||
|
||||
if [ -f "$file" ] && grep "$plugin" "$file" > /dev/null; then
|
||||
sed -i '' -e "s/$plugin .*/$plugin ${versions[*]}/" "$file"
|
||||
sed -i.bak -e "s/$plugin .*/$plugin ${versions[*]}/" "$file"
|
||||
rm "$file".bak
|
||||
else
|
||||
echo "$plugin ${versions[*]}" >> "$file"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user