I am trying to execute a very simple shell script that removes a file if it exists, and then copies a file from hdfs to the local system.
#!/bin/bash
rm -f /local/file
hdfs dfs -get /path/to/hdfs /local/file
Both commands work individually in the terminal, but fail when run as a script. Running
rm /local/file
fails with
rm: cannot remove ‘/local/file\r’: No such file or directory
hdfs dfs -get /path/to/hdfs
fails with get: unexpected URISyntaxException
What am I doing wrong here?