mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-05-18 13:21:30 +08:00
Co-authored-by: Андрій Шовкошитний <198119344+enlightened88@users.noreply.github.com> Co-authored-by: Jordan Harband <ljharb@gmail.com>
23 lines
521 B
Bash
Executable File
23 lines
521 B
Bash
Executable File
#!/bin/sh
|
|
|
|
die () { echo "$@" ; exit 1; }
|
|
|
|
\. ../../common.sh
|
|
|
|
TMPFILE="$(mktemp)"
|
|
trap 'rm -f "${TMPFILE}"' EXIT
|
|
|
|
make_echo "${TMPFILE}" "hello_nvm" || die 'make_echo returned non-zero'
|
|
|
|
# shebang must still be on line 1
|
|
[ "$(head -n 1 "${TMPFILE}")" = '#!/bin/sh' ] \
|
|
|| die 'make_echo overwrote the shebang'
|
|
|
|
# script body must be present
|
|
grep -q 'hello_nvm' "${TMPFILE}" \
|
|
|| die 'make_echo did not write the echo body'
|
|
|
|
# file must be executable
|
|
[ -x "${TMPFILE}" ] \
|
|
|| die 'make_echo did not chmod the file'
|