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

  Unix/Linux 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 Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 09-05-2013
jiam912's Unix or Linux Image
jiam912 jiam912 is offline
Registered User
 
Join Date: Aug 2010
Last Activity: 5 March 2015, 3:46 PM EST
Location: EEUU
Posts: 186
Thanks: 130
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. Unix or Linux Image


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 Unix and Linux 09-05-2013
disedorgue disedorgue is offline
Registered User
 
Join Date: Sep 2013
Last Activity: 5 March 2015, 3:28 PM EST
Location: France
Posts: 284
Thanks: 20
Thanked 99 Times in 93 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 Unix and Linux 09-05-2013
jiam912's Unix or Linux Image
jiam912 jiam912 is offline
Registered User
 
Join Date: Aug 2010
Last Activity: 5 March 2015, 3:46 PM EST
Location: EEUU
Posts: 186
Thanks: 130
Thanked 0 Times in 0 Posts
Hi disedorgue

It works fine thanks a lot
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image 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 03:06 PM
Need a script to convert csh to bash vineet.dhingra Shell Programming and Scripting 3 07-18-2011 11:27 AM
How to run a bash script in csh shell? rubinovito Shell Programming and Scripting 3 04-08-2011 10: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 04:17 AM
Converting bash script to csh Kweekwom Shell Programming and Scripting 4 07-11-2007 06:54 PM



All times are GMT -4. The time now is 11:57 PM.