read command doesn't wait for input
Because your script starts with #!/bin/sh
rather than #!/bin/bash
, you aren't guaranteed to have bash extensions (such as read -p
) available, and can rely only on standards-compliant functionality.
See the relevant standards document for a list of functionality guaranteed to be present in read
.
In this case, you'd probably want two lines, one doing the print, and the other doing the read:
printf 'press [ENTER] to continue deleting...'
read _
You can do this with echo command too!:
echo "press [ENTER] to continue deleting line"
read continue