How fix "syntax error: unexpected end of file" of shell script on linux - bantoilatoi

Breaking

Post Top Ad

Post Top Ad

Friday, December 1, 2017

How fix "syntax error: unexpected end of file" of shell script on linux

DOS-based text files use a pair of carriage return (CR) and line feed (LF) as a new-line delimiter. On the other hand, UNIX-based text files simply use LFs to terminate each line. In order to convert a text file from DOS format to UNIX format, you can use a command-line tool called dos2unix.
To install dos2unix on CentOS, Fedora or RHEL:
$ sudo yum install dos2unix
To install dos2unix on Ubuntu or Debian:
$ sudo apt-get install tofrodos
$ sudo ln -s /usr/bin/fromdos /usr/bin/dos2unix


OR:
 Other answers show how to download and compile dos2unix, but if you're simply looking to convert files from DOS-style line endings (CR-LF) to Unix-style line endings, there are several other approaches which shouldn't involve installing anything:

-  if you have tr: tr -d '\r' < input > output

- if you have Perl: perl -pi -e 's/\r\n/\n/g' input (which converts the file in-place, same as dos2unix)

- if you have sed: sed -i 's/^M$//' input where you'd press CtrlV then CtrlM to get ^M

RELASE:
- https://www.centos.org/docs/5/html/5.4/Technical_Notes/dos2unix.html
- http://rpmfind.net/linux/rpm2html/search.php?query=dos2unix&submit=Search+...&system=&arch=
- https://unix.stackexchange.com/questions/277217/how-to-install-dos2unix-on-linux-without-root-access

Post Top Ad