Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and 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: 8 July 2015, 11:25 AM EDT
Location: EEUU
Posts: 221
Thanks: 157
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. Linux


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: 22 July 2015, 3:55 AM EDT
Location: France
Posts: 320
Thanks: 25
Thanked 116 Times in 110 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: 8 July 2015, 11:25 AM EDT
Location: EEUU
Posts: 221
Thanks: 157
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

Linux 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:19 AM.