000017447 - Error message '/bin/bash^M: bad interpreter: No such file or directory' when running a RSA NetWitness Platform script

Document created by RSA Customer Support Employee on Apr 14, 2017Last modified by RSA Customer Support on Sep 26, 2019
Version 3Show Document
  • View in full screen mode

Article Content

Article Number000017447
Applies ToRSA Product Set: NetWitness Logs and Network
RSA Product/Service Type: Core Appliance
Platform: CentOS
Issue

Getting the error message "/bin/bash^M: bad interpreter: No such file or directory" when running an RSA NetWitness shell script.

For example, unable to execute the nwtech.sh shell script.
 





For example, getting a similar style of error, unable to execute a python script.

User-added image
Cause

This error occurs because the script has been created from a Windows workstation and saved as a DOS format file.

The format of Windows and Linux text files differs slightly. In Windows, lines end with both the carriage return (CR) and line feed (LF) ASCII characters, but Linux uses only a line feed (LF).

This can be confirmed by opening the script with the vi editor on the appliance, where [dos] will be seen in the bottom-left corner after the script name for a DOS formatted file.





Or running the file command on the NetWitness appliance against the script files if the output shows the lines are terminated with CRLF (Carriage Return, Linefeed characters) then this indicates a DOS formatted file.

User-added image

Or some Linux programs will display the carriage return as a Ctrl-m (^M) character at the end of each line in the DOS formatted file.

User-added image

Resolution

In order to change the DOS formatted file to the Linux file format, use the following vi commands on the NetWitness appliance.

If you see ^M characters then delete the Windows Carriage Return (CR) characters from the end of the lines using the following command within vi:
 




:%s/\r//g



Also, run the following vi commands:
 




:set ff=unix
:wq!



You will then be able to execute the script without any issue. If you require further assistance, please contact RSA Customer Support.

Legacy Article IDa65166

Attachments

    Outcomes