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
passing variable from bash to perl from bash script arsidh Shell Programming and Scripting 10 06-04-2008 12:25 PM
Why generate "ash and bash" different output for same bash script? s. murat Shell Programming and Scripting 0 05-26-2008 07:19 AM
Problem in running bash shell commands on HP-UX machine abhishek0071 UNIX for Advanced & Expert Users 6 02-15-2008 03:30 PM
how to make a bash script that can be executed by people simultaneously? jimmbp Shell Programming and Scripting 4 01-31-2006 01:15 PM
How to make bash script abort? siegfried Shell Programming and Scripting 1 11-23-2005 12:15 PM

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 11-17-2008
npatwardhan npatwardhan is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 135
how to make your bash script run on a machine with csh and bash

hi,
i have a script that runs on bash and would like to run it on a machine that has csh and bash. the default setting on that machine is csh. i dont want to change my code to run it with a csh shell. is there any way i can run the script (written in bash) on this machine? in other words is there any statement i can put in my script that will change the script on the host machine from csh to bash?
  #2 (permalink)  
Old 11-17-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,293
Replace the shebang of your script with (supposing you have bash in the director /bin):

Code:
#!/bin/bash
  #3 (permalink)  
Old 11-18-2008
npatwardhan npatwardhan is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 135
ok this is an old machine..here are first few lines from the script:

Code:
#!/sbin/sh

start_time=`date +%s`
binarray=(20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20)

awk 'NR>20&&NR<32' try.sum | awk '{print $4 }' >io
awk 'NR>20&&NR<32' try.sum | awk '{print $9 }' >io1
awk 'NR>20&&NR<32' try.sum | awk '{print $14 }'>io2
 
count=0
exec 10<io
while read LINE <&10; do
    ARRAY[$count]=$LINE
    ((count++))
done


when i run it,it complains about the binarray statement and also says command 10: not found..
  #4 (permalink)  
Old 11-19-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,293
Have you tried to replace the shebang?

Regards
Sponsored Links
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 06:27 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