From: John Summerfied <debian@xxxxxxxxxxxxxxxxxxxxxx>
Reply-To: For users of Fedora Core releases <fedora-list@xxxxxxxxxx>
To: For users of Fedora Core releases <fedora-list@xxxxxxxxxx>
Subject: Re: scripts
Date: Fri, 03 Mar 2006 05:22:53 +0800
Les Mikesell wrote:
On Thu, 2006-03-02 at 14:18, azeem ahmad wrote:
hi list
i got some scripts. their behavior is much wierd, they dont execute, when
i run them they say
bad interpreter
and if i open them and copy them into a new file which i create using vi
then the same script executes.
it seems to be a problem of encoding like ASCII etc
can i change them using any tools
any suggestions
They were probably created under windows and transferred over
with carriage-return, line-feed endings intact. If you
load them into vim, type :set fileformat=unix and save
again it should fix them. Or use the dos2unix program.
There's a magic perl incantation you can recite. Or you can
cat olddir/script | tr -d '\r' >newdir/script
for all and at the end
chmod +x newdir/*
A quicker way with vim:
for $f in olddir/* ; do vim -c ':set fileformat=unix' -c :wq $f ; donw
Any more ways to change this light bulb?
--
Cheers
John
-- spambait
1aaaaaaa@xxxxxxxxxxxxxxxxxxxxxxx Z1aaaaaaa@xxxxxxxxxxxxxxxxxxxxxxx
Tourist pics http://portgeographe.environmentaldisasters.cds.merseine.nu/
do not reply off-list
thanks Mr. Mikesell, it worked, othewise i was in a lot trouble
Regards
Azeem