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

My ed can't handle commands this fast #12

Open
gagern opened this issue Dec 8, 2016 · 0 comments
Open

My ed can't handle commands this fast #12

gagern opened this issue Dec 8, 2016 · 0 comments

Comments

@gagern
Copy link

gagern commented Dec 8, 2016

Ed is strange. At least the ed in macOS 10.12. Following the procedure outlined in the README, I observed ed print ? and then exit with exit status 2. Aparently something went wrong, but what? After some experimentation it looks as though ed would receive its commands faster than it could handle them. Which is strange, as it should be able to simply not perform any input while it's still busy. Nevertheless, providing the script at stdin would fail while typing the commands one at a time worked. In the end I ran the script as follows:

sed 's/#.*//'  move_drop_indexes.ed | grep -v '^$' | while read -r i; do
    sleep 1
    echo "$i" 1>&2
    echo "$i"
done | ed databasename.psql

This leaves one second delay between subsequent commands. It also strips comments, but that by itself was not enough to make this work for me. It prints the commands to standard error, so that in case of an error one can see which command failed.

Do you want to add any of this to the command line? Or move this over to Python instead of ed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant