0

I'm wrote small bash shell script named hello.sh, that will ask the user to enter his name and again prints the user entered name.

#!/bin/bash

echo "Enter your name : "
read uname
echo "Hello " $uname ", Welcome to shell scripting."

when I run the script, ./hello.sh it won't wait for user input and gives me the below output

./hello.sh: line 2: $'\r': command not found
': not a valid identifiere 3: read: `uname
Hello  , Welcome to shell scripting.

Please help on this.

user2636874
  • 889
  • 4
  • 15
  • 36
  • Your script has DOS CRLF endings. Run `dos2unix hello.sh` and rerun your script – Inian May 20 '20 at 07:26
  • when I run dos2unix hello.sh, saying dos2unix hello.sh dos2unix: Failed to change the permissions of temporary output file ./d2utmpKyz65o: Operation not permitted dos2unix: problems converting file hello.sh – user2636874 May 20 '20 at 07:51

0 Answers0