Shell script will not run, permission denied

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 6839 Views - Last Post: 27 December 2012 - 12:32 PM

#16 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: Shell script will not run, permission denied

Posted 27 December 2012 - 12:05 PM

When I get those after editing files from Windows, I run the following in vi :

:%s/.$//g

Problem is, there is never one of those ^M on the last line, so that char gets whacked.

I don't know what the above will do if they are not visible.
Was This Post Helpful? 2
  • +
  • -

#17 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2770
  • View blog
  • Posts: 4,429
  • Joined: 21-June 11

Re: Shell script will not run, permission denied

Posted 27 December 2012 - 12:21 PM

To make the ^Ms visible in vim, you can use :e ++ff=unix. Then you can delete them like regular characters.

There's also a command line tool called dos2unix, which removes carriage returns from files automatically.
Was This Post Helpful? 2
  • +
  • -

#18 gregwhitworth   User is offline

  • Tired.
  • member icon

Reputation: 221
  • View blog
  • Posts: 1,613
  • Joined: 20-January 09

Re: Shell script will not run, permission denied

Posted 27 December 2012 - 12:32 PM

Very helpful guys. Thanks for the help, and the patience as I am no UNIX guru.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2