# No such file or directory error

**URL:** <https://community.unix.com/t/no-such-file-or-directory-error/374920>\
**Category:** Shell Programming and Scripting\
**Created:** [February 19, 2019, 7:42pm UTC](https://community.unix.com/t/no-such-file-or-directory-error/374920 "2019-02-19T19:42:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TryAgain12](https://community.unix.com/letter_avatar/tryagain12/32/6_449c533f586939b6e5f246632a46421f.png) [@TryAgain12](https://community.unix.com/u/TryAgain12)\
**Post date:** [February 19, 2019, 7:42pm UTC](https://community.unix.com/t/no-such-file-or-directory-error/374920/1 "2019-02-19T19:42:11Z")

</div>

I am new to shell scripting so I assume there is something basic I am missing but I have not been able to figure it out. When I run the following code from a script it can't find the paths to the directory or files. I can literally cut and paste the commands into terminal and they work fine. Why can't these paths be found when run from a script? I have done chmod 755 getup.sh.

```nohighlight
#!/bin/bash
MC2XML="/Users/ericphil2/Scripts/mc2xml"
XMLTV="/Users/ericphil2/Scripts/xmltv.xml"
#Set the working directory
cd /Users/ericphil2/Scripts
#Get new schedule
	$MC2XML -J -c us -g 14519
#Reload EyeTV with the file
	open -a EyeTV $XMLTV

```

This the response from running the script:

```nohighlight
[MacPro:~/Scripts] ericphil2% sh ./getepg.sh
: No such file or directorysers/ericphil2/Scripts
: No such file or directory/ericphil2/Scripts/mc2xml
 does not exist.ericphil2/Scripts/

```

---

<div class="post-metadata">

**Author:** ![Scrutinizer](https://community.unix.com/user_avatar/community.unix.com/scrutinizer/32/1216_2.png) [@Scrutinizer](https://community.unix.com/u/Scrutinizer)\
**Post date:** [February 19, 2019, 10:38pm UTC](https://community.unix.com/t/no-such-file-or-directory-error/374920/2 "2019-02-19T22:38:40Z")

</div>

My guess is your script contains carriage return characters. Perhaps it has been edited on a Windows host?  
You can remove them with a `dos2unix` utility if present or with the following command:

```nohighlight
tr -d '\r' < oldfile > newfile

```

---

<div class="post-metadata">

**Author:** ![TryAgain12](https://community.unix.com/letter_avatar/tryagain12/32/6_449c533f586939b6e5f246632a46421f.png) [@TryAgain12](https://community.unix.com/u/TryAgain12)\
**Post date:** [February 20, 2019, 5:01pm UTC](https://community.unix.com/t/no-such-file-or-directory-error/374920/3 "2019-02-20T17:01:48Z")

</div>

Thanks, `tr` fixed the problem. I now have the script running daily with a launch agent.
