The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Calling a shell script from php eltinator Shell Programming and Scripting 1 04-22-2008 01:16 AM
Calling SQL LDR and SQL plus scripts in a shell script rajagavini Shell Programming and Scripting 5 11-05-2007 06:12 PM
Calling Shell Script onlyroshni Shell Programming and Scripting 1 10-22-2007 07:29 PM
Box A's perl script calling box B's shell script new2ss Shell Programming and Scripting 1 09-13-2006 06:17 AM
Calling shell script ? Ravi_Kandula Shell Programming and Scripting 1 10-07-2002 09:30 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-07-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
calling dos2unix on shell script from within the script

I have a build script. It was created on Linux. For some reason, I got it to windows and modified it. And brought it back again to Linux.

Since there is the question of the ^M chars appearing, the way out is to do a dos2unix on the script file. This is done manually.

Is there a way to call dos2unix on the script from within the script itself ?

I tried the following:
The first line in the script was
dos2unix $0

The error I got was:
sh build.sh
: command not found
dos2unix: converting file build.sh to UNIX format ...
to UNIX format ...g file
dos2unix: problems converting file
: command not found
: command not found
'uild.sh: line 30: syntax error near unexpected token `
'uild.sh: line 30: `function o ()

Any pointers ?

Vino
  #2 (permalink)  
Old 04-07-2005
encrypted's Avatar
encrypted encrypted is offline Forum Advisor  
Registered User
  
 

Join Date: Feb 2004
Location: Oslo, Norway
Posts: 219
You can call this script build.sh from another script say format.sh
and before executing the script do a dos2unix on build.sh
  #3 (permalink)  
Old 04-07-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Encrypted,

Yes, that would work.

Still, if there anyway to do this.

Vino
  #4 (permalink)  
Old 04-07-2005
bhargav's Avatar
bhargav bhargav is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2004
Location: USA
Posts: 511
Quote:
Originally Posted by vino
sh build.sh
: command not found
dos2unix: converting file build.sh to UNIX format ...
to UNIX format ...g file
dos2unix: problems converting file
: command not found
: command not found
Vino
Please check PATH in your build scripts.
Couple of 'command not founds' there.
Quote:
I tried the following:
The first line in the script was
dos2unix $0
what are u trying to do ?

is it not

dos2unix $1 ??
  #5 (permalink)  
Old 04-08-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
I have a build script. If dos2unix is not carried out on that script, then you get the errors that I had displayed.

I am trying to call dos2unix on the calling script. i.e. the one denoted by $0.

$1 refers to the first argument. No, I am not calling dos2unix on the first argument. Rather on the script which issued the dos2unix.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:54 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0