LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-13-2009, 04:55 AM   #1
Libu
Member
 
Registered: Oct 2003
Location: Chennai
Distribution: Slackware 12.1
Posts: 165

Rep: Reputation: 36
Can a "Bourne shell script text executable" installer be modified manually ?


I have a file..say filename.bin, which is an installer

Code:
$> file filename.bin
filename.bin: Bourne shell script text executable
However when I execute this binary:

Code:
$> ./filename.bin
-bash: ./filename.bin: /bin/sh^M: bad interpreter: No such file or directory

Now my question is can I safely try changing the first line of the binary which is #!/bin/sh ? Would it affect the way the binary is run ?

NOTE: /bin/sh exists and is a link to bash. Also when I open filename.bin using vim I do not see any special characters at the end of interpreter line. (I used :se list)

Thanks in advance.
 
Old 03-13-2009, 06:04 AM   #2
hedgy102
Member
 
Registered: Mar 2009
Distribution: Debian,Centos
Posts: 30

Rep: Reputation: 16
Seems to me that this file was originally created on a windows machine.

The easiest way to fix this is to install a package called tofrodos which includes a command called dos2unix among others.

All you will need to do is run:
Code:
dos2unix filename
Good luck.
 
Old 03-13-2009, 06:09 AM   #3
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
Have you tried:
Code:
* []dos2unix <infile> <outfile>
Maybe you'll need to install sysutils for that to work.
Or:
Code:
* []cat <infile> | tr -d ``\r'' > <outfile>
This is from Snort docs.

Last edited by alan_ri; 03-13-2009 at 06:17 AM.
 
  


Reply

Tags
bash, bin, executable, file, script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lost option to "Open with text editor" executable script in 8.04 taylorkh Ubuntu 2 02-04-2009 10:49 AM
converting shell script from "dialog" to "xdialog" kushalkoolwal Programming 1 02-25-2008 08:40 PM
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM
running an executable from a bourne shell which returns a value anekkan Programming 6 09-19-2005 07:59 PM
1. shell script "find and replace" on text 2. java GUI application randomx Programming 4 03-05-2004 01:01 PM


All times are GMT -5. The time now is 05:30 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration