Bad interpreter error – linux shell script

I recently encountered this error after modifying a shell script in Windows then FTPing it to a linux server. When executing the script in SSH, I got the following error:

: bad interpreter: No such file or directory

Apparently there are issues with carriage returns and line feeds CR/LF between windows and linux. A simple perl command fixed the issue.

?View Code BASH
perl -i -pe's/\r$//;' <filename>

This entry was posted on Wednesday, April 15th, 2009 at 12:27 pm and is filed under Code. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

« MintTv
TI-86 Intervalometer for Canon XTi »

Comments are closed.

potatoeskillme
  • Stuff

    • Building a Carputer
    • Jackson Hole Road Trip
    • Trails Highlights
    • Lake Don Pedro
    • July 4th, 2009 – 41st Newport
    • Morning Surf 7.24.09
    • Wedge 7.24.09
    • Morning Surf 7.25.09
    • Big Bear B-day Bash
    • Yosemite Aug 2009
    • NJ Surf Trip Sept 2009
    • Mammoth Thanksgiving 09
    • Jackson Hole Road Trip Redux
    • Deer Valley Spring Skiing
    • Big Bear Session
    • Sequoia 2010
    • Photos
  • Recent Posts

    • TI-86 Intervalometer for Canon XTi
    • Bad interpreter error – linux shell script
    • MintTv
    • PHP cURL
    • Export MySQL Data to CSV File
  • Categories

    • Code
    • Older Projects
    • Uncategorized
  • Links

    •  Kyle Cummings Resume
    • Alexei Udarbe
    • Evan Wise
    • John Rivas
    • Mary Redaelli