‘bash\r’: No such file or directory: Difference between revisions

From Cramsession
Jump to navigationJump to search
✍️ Verified Author: MflavellClick to view professional profile & credentials
(Created page with "Computer Notes > Linux > ‘bash\r’: No such file or directory That error is a classic "invisible" headache. It usually happens because of a disagreement between Windows and Unix-based systems (like Linux or macOS) on how a line of text should end. ==The Culprit: Line Endings== In the world of text files, there are two main ways to signal the end of a line: LF (Line Feed): Used by Linux/macOS. Represented as \n. CRLF (Carriage Return + Line Feed): Used by W...")
 
No edit summary
 
Line 1: Line 1:
[[Computer Notes]] > [[Linux]] > ‘bash\r’: No such file or directory
[[Computer Notes]] > [[Linux]] > ‘bash\r’: No such file or directory


That error is a classic "invisible" headache. It usually happens because of a disagreement between Windows and Unix-based systems (like Linux or macOS) on how a line of text should end.
=Overview==
 
This is a classic "invisible" headache. It usually happens because of a disagreement between Windows and Unix-based systems (like Linux or macOS) on how a line of text should end.


==The Culprit: Line Endings==
==The Culprit: Line Endings==
In the world of text files, there are two main ways to signal the end of a line:
In the world of text files, there are two main ways to signal the end of a line:



Latest revision as of 22:40, 16 May 2026

Computer Notes > Linux > ‘bash\r’: No such file or directory

Overview=

This is a classic "invisible" headache. It usually happens because of a disagreement between Windows and Unix-based systems (like Linux or macOS) on how a line of text should end.

The Culprit: Line Endings

In the world of text files, there are two main ways to signal the end of a line:

LF (Line Feed): Used by Linux/macOS. Represented as \n.

CRLF (Carriage Return + Line Feed): Used by Windows. Represented as \r\n.

When you see ‘bash\r’, it means your system is trying to execute a file that has Windows-style line endings. The system reads bash plus that invisible carriage return (\r) as the name of the interpreter. Since there is no program actually named bash\r, it throws the "No such file or directory" error.


Fix

sed -i 's/\r$//' your_script_name.sh