Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS 运行install.sh出错 #258

Open
MJFcoNaN opened this issue May 27, 2019 · 7 comments
Open

macOS 运行install.sh出错 #258

MJFcoNaN opened this issue May 27, 2019 · 7 comments

Comments

@MJFcoNaN
Copy link

remote: Total 18 (delta 1), reused 10 (delta 0)
Unpacking objects: 100% (18/18), done.
Removing old configurations...
Installing new configurations...
sed: 1: "/etc/dnsmasq.d/accelera ...": extra characters at the end of d command

Google该错误后,似乎是因为Unix中sed的用法有些不同,根据一些建议,第37行加一个空字符后可用,即:
sed -i "" "s|^(server.)/[^/]$|\1/$_server|" /etc/dnsmasq.d/*."$_server".conf

@erickyim
Copy link

erickyim commented Jun 10, 2019

@MJFcoNaN

sed -i "" "s|^(server.)/[^/]$|\1/$_server|" /etc/dnsmasq.d/*."$_server".conf
seems not work on macOS 10.14.5 ...

Removing old configurations...
Installing new configurations...
sed: 1: "s|^(server.)/[^/]$|\1/1 ...": \1 not defined in the RE

@MJFcoNaN
Copy link
Author

@erickyim
Curiously...
It works for me (macOS Mojave 10.14.5)

remote: Total 18 (delta 1), reused 10 (delta 0) Unpacking objects: 100% (18/18), done. Removing old configurations... Installing new configurations... Restarting dnsmasq service... Now please restart dnsmasq since I don't know how to do it. Cleaning up...

@erickyim
Copy link

OK, it's a copy-paste issue.

# macOS
sed -i "" "s|^\(server.*\)/[^/]*$|\1/$_server|" /etc/dnsmasq.d/*."$_server".conf

Now works...

@felixonmars
Copy link
Owner

sed -i "" seems to be a macos only solution as it doesn't work in linux version of sed. Someone on stackoverflow suggests that sed -i="" works cross-platform and I have tried it on Linux, could you confirm that it works on macos too?

@MJFcoNaN
Copy link
Author

@felixonmars
yes, sed -i="" works on macOS.

@erickyim
Copy link

seems not work.

Jietu20190618-171949

@MJFcoNaN
Copy link
Author

"=" is considered as the extension of backup files...
But I think this does not imperil the function, does it?
-i extension Edit files in-place, saving backups with the specified extension. If a zero- length extension is given, no backup will be saved. It is not recommended to give a zero-length extension when in-place editing files, as you risk corrup- tion or partial content in situations where disk space is exhausted, etc.

xiagw added a commit to xiagw/dnsmasq-china-list that referenced this issue Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants