This commit is contained in:
2023-06-08 12:36:39 +02:00
parent bde200bd5c
commit 02a414f9cb
3 changed files with 8 additions and 6 deletions

View File

@@ -11,9 +11,6 @@ usage() {
exit 0
}
# Default values
dry_run=false
# Parse command-line options
while [ $# -gt 0 ]; do
case "$1" in
@@ -52,6 +49,11 @@ while [ $# -gt 0 ]; do
shift
done
# Apply default values if required
if [ -z "$dry_run" ]; then
dry_run=false
fi
if [ -z "$target_file" ]; then
target_file="${MSMAP_TARGET_ROOT}/usr/bin/manjaro-sway-mirrors"
fi
@@ -66,7 +68,7 @@ if [ -z "$replace_pattern" ]; then
replace_pattern='\$(pacman-mirrors -G \| sed \"s/^arm-//\")'
fi
sed_command="sed -i \"s|${search_pattern}|${replace_pattern}|g\" \"${target_file}\""
sed_command="sed -i 's|${search_pattern}|${replace_pattern}|g' '${target_file}'"
# Perform the sed command
if $dry_run; then
echo "$sed_command"