If you're OK in having a node-esm executable, please consider this solution.
#!/usr/bin/env sh
# the /usr/local/bin/node-esm executable
input_file=$1
shift
exec node --input-type=module - $@ <$input_fileIf you're OK in having a node-esm executable, please consider this solution.
#!/usr/bin/env sh
# the /usr/local/bin/node-esm executable
input_file=$1
shift
exec node --input-type=module - $@ <$input_file| function rext () { | |
| if [ $# -lt 3 ]; then | |
| echo 1>&2 "$0 needs 3 arguments as DIR SOURCE_EXT DEST_EXT" | |
| else | |
| for file in "$1"/*.$2; do | |
| mv "$file" "${file%.$2}.$3" | |
| done | |
| fi | |
| } |