Changing script from csh to bash | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

Changing script from csh to bash

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 09-05-2013
jiam912's Avatar
jiam912 jiam912 is offline
Registered User
 
Join Date: Aug 2010
Last Activity: 3 September 2014, 4:43 PM EDT
Location: Ecuador
Posts: 140
Thanks: 99
Thanked 0 Times in 0 Posts
Changing script from csh to bash

Hello Guys

I have a script working fine on csh, but I would like to change it to bash, how I should change this command to be able to work as bash script.


Code:
if ( $fsw > "0" ) then

foreach swath ( `awk 'BEGIN {for (i='$fsw';i<='$lsw';i++) printf ("%s\n", i) }'` )

## work to be done

end 
end if

Sponsored Links
    #2  
Old 09-05-2013
disedorgue disedorgue is offline
Registered User
 
Join Date: Sep 2013
Last Activity: 24 October 2014, 7:29 AM EDT
Location: France
Posts: 202
Thanks: 12
Thanked 61 Times in 59 Posts
Hello,
Something as:

Code:
if [ $fsw -gt 0 ]; then
for swath in $(awk 'BEGIN {for (i='$fsw';i<='$lsw';i++) printf ("%s\n", i) }')
do

## work to be done

done
fi

Regards.
The Following User Says Thank You to disedorgue For This Useful Post:
jiam912 (09-05-2013)
Sponsored Links
    #3  
Old 09-05-2013
jiam912's Avatar
jiam912 jiam912 is offline
Registered User
 
Join Date: Aug 2010
Last Activity: 3 September 2014, 4:43 PM EDT
Location: Ecuador
Posts: 140
Thanks: 99
Thanked 0 Times in 0 Posts
Hi disedorgue

It works fine thanks a lot
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
error LD: undefined variable while changing shell from bash to csh Avinash Nayak Ubuntu 1 08-28-2012 02:06 PM
Need a script to convert csh to bash vineet.dhingra Shell Programming and Scripting 3 07-18-2011 10:27 AM
How to run a bash script in csh shell? rubinovito Shell Programming and Scripting 3 04-08-2011 09:12 AM
how to make your bash script run on a machine with csh and bash npatwardhan Shell Programming and Scripting 3 11-19-2008 03:17 AM
Converting bash script to csh Kweekwom Shell Programming and Scripting 4 07-11-2007 05:54 PM



All times are GMT -4. The time now is 03:01 AM.