how to convert from csh to sh


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to convert from csh to sh
# 1  
how to convert from csh to sh

Dear all
I am installing some eda software using script. My OS is ubuntu 10.04 and the eda software writing in csh. Since ubuntu reading script file in sh writting. I need someone can help me to convert some definition in script from csh to sh. Below is part of script

Code:
set archinfo = `$installdir/bin/get_arch -r -c -t`
setenv ARCH $archinfo[1]
setenv CMIARCH $archinfo[2]
setenv mraarch ${ARCH}
setenv TMIARCH ${CMIARCH}
unsetenv OMP_NUM_THREADS
unsetenv KMP_BLOCKTIME
unsetenv LANG
unsetenv LC_ALL
limit coredumpsize 0

The sh cell command will post the error when it sees : setenv, unsetenv, limit and [ ]
How I can make a change of thoses? Thanks a lot

Last edited by Scott; 12-04-2011 at 08:06 AM.. Reason: Code tags
# 2  
Why don't you run it with csh?
Code:
/usr/bin/csh <your script>

Or is it that you don't have csh? If so, you can try this...
Code:
archinfo=( $( $installdir/bin/get_arch -r -c -t ) )
export ARCH=${archinfo[1]}
export CMIARCH=${archinfo[2]}
export mraarch=${ARCH}
export TMIARCH=${CMIARCH}
export OMP_NUM_THREADS=""
export KMP_BLOCKTIME=""
export LANG=""
export LC_ALL=""
ulimit -c 0

HTH
--ahamed
# 3  
Hi ahamed
Thanks for your help. I am a newbie to linux and my major in electrical hardware. Changing a new language is realy top for me in short time. If you dont mind could you help me to correct the script below to sh? Thanks


Code:
######### HSPICE Global environment variable Sat Dec  3 09:43:05 PST 2011 #########
# Using FLEXlm license file

setenv installdir /home/synopsys/D-2010.03/hspice

set archinfo = `$installdir/bin/get_arch -r -c -t`
setenv ARCH $archinfo[1]
setenv CMIARCH $archinfo[2]
setenv mraarch ${ARCH}
setenv TMIARCH ${CMIARCH}

unsetenv OMP_NUM_THREADS
unsetenv KMP_BLOCKTIME
unsetenv LANG
unsetenv LC_ALL
limit coredumpsize 0

setenv HSP_HOME $installdir
if ( $?PVA_HDL ) then
    if (( $PVA_HDL == 0 ) || ($ARCH == "rs6000")) then
        unsetenv PVA_HDL
    else
        setenv PVA_HDL 1
    endif
else if ($ARCH != "rs6000") then
    setenv PVA_HDL 1
endif

if ( $?UNIFIED_VA) then
    if ( $UNIFIED_VA == 0) then
        unsetenv PVA_HDL
    endif
endif

setenv SNPS_PLATFORM     $ARCH

set XARCH = $ARCH
if ( -f /etc/SuSE-release ) then
    set XARCH = suse64    # must use suse64 gcc compiler for suse32
else
    if ( Xi686 == X"x86_64" ) then
        set XARCH = amd64
    endif
endif

if ( $XARCH == x86sol32 ) then
    set X86SOL = -R/usr/sfw/lib
else
    set X86SOL = ""
endif

if ($ARCH != "rs6000") then
    setenv HSP_GCC  "$HSP_HOME/GNU/$XARCH/gcc-4.2.2-static/bin/gcc $X86SOL"
    setenv HSP_GCC_VERSION   `$HSP_GCC -dumpversion`
endif

if ( $?LM_LICENSE_FILE ) then
    if (( "$LM_LICENSE_FILE" !~  *"/home/synopsys/D-2010.03/hspice/license.dat"* )&& (-e  /home/synopsys/D-2010.03/hspice/license.dat)) then
      setenv LM_LICENSE_FILE /home/synopsys/D-2010.03/hspice/license.dat:$LM_LICENSE_FILE
   endif
else
   if (-e /home/synopsys/D-2010.03/hspice/license.dat) then
      setenv LM_LICENSE_FILE /home/synopsys/D-2010.03/hspice/license.dat
   endif
endif


set path= (  $HSP_HOME/bin $installdir/$ARCH  $path )



######### End of Global section ##########


Last edited by Scott; 12-04-2011 at 08:07 AM.. Reason: Code tags, please.
# 4  
Quote:
Originally Posted by tompham
Hi ahamed
Thanks for your help. I am a newbie to linux and my major in electrical hardware. Changing a new language is realy top for me in short time. If you dont mind could you help me to correct the script below to sh? Thanks
Your script is tried and tested by the developers of the system you want to install and will work. It is possible for someone here to convert it to sh or bash for you and it work first time, but I would not want to chance it and it is better if you can run the original script. If tcsh does not exist on your system get it with the command:
Code:
sudo apt-get install tcsh

Then you will be able to run the code without having to rewrite it.

Andrew
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #222
Difficulty: Easy
NetMarketShare reported that the combined versions of Microsoft Windows lead the worldwide market with close to a 93% market share at the end of August 2011, followed by OS X at 6%, and Linux with 1%.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using CSH and need to convert html to PDF

Hi, I am currently using the below code and it throws an error saying badly placed ()'s. I am not sure if this right way to convert html to PDF, please help..I am using C-shell script system ("../html2doc pdf 1000 portrait html$prnfile.html $prnfile.pdf ") print "Content-type:application/pdf... (7 Replies)
Discussion started by: lakers646
7 Replies

2. Shell Programming and Scripting

Is there any script to convert sh to csh ?

Hi All Is there anyone who have the script to covnert a sh sell script to csh and can share with me? Thanks a lot! Nick:b: (3 Replies)
Discussion started by: nicolast0604
3 Replies

3. Shell Programming and Scripting

Convert .sh to .csh

Hi All, Could any one of you give me a hand to convert the following line of codes from .sh to .csh please ? proc_id=`fuser /tmp/test` if then echo "File is not being used by any thing" fi if then echo "File is being used... please wait" sleep 1 fi Regards. ---------- Post... (1 Reply)
Discussion started by: sraj142
1 Replies

4. Shell Programming and Scripting

.sh to .csh

Hi All, Could any one of you give me a hand to convert the following line of codes from .sh to .csh please ? proc_id=`fuser /tmp/test` if then echo "File is not being used by any thing" fi if then echo "File is being used... please wait" sleep 1 fi Regards. (1 Reply)
Discussion started by: sraj142
1 Replies

5. Shell Programming and Scripting

Need a script to convert csh to bash

Hi, Can anyone give me a script to convert csh to bash? or any key points which can help me to do so as i am new to it. (3 Replies)
Discussion started by: vineet.dhingra
3 Replies

6. Shell Programming and Scripting

Convert from Csh to Perl

Hi , I am trying to convert the below code embedded in a csh script to Perl. Can any expert give me some advice on this ? sed -n ''"$start_line"',$ p' $tester_dir/nfiles_extracted.txt|cut -c1-4,6-|/bin/perl $test_summary/compare_for_all _Duts.pl|sort > $tester_dir/nfiles_extracted1.txt (0 Replies)
Discussion started by: Raynon
0 Replies

7. UNIX for Dummies Questions & Answers

How to Convert to CSH File

Hi Everyone, I have a body of code that I'd like to know how to convert to a csh file. In Unix, under a directory, I wish to ls into each of its subdirectories: In Unix prompt I type foreach i(*) foreach? ls $i foreach? end however, when I try to store this body of code in .csh: ... (2 Replies)
Discussion started by: tommms
2 Replies

8. Shell Programming and Scripting

csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them) Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Discussion started by: pollsizer
1 Replies

9. Shell Programming and Scripting

how to convert things from csh to sh

i have this method in csh that check for file exist. #check that file exists if ( ! -e $6$5 ) then echo $6$5 Not Found exit 8 endif however i wanted in to be in just sh. so i change the code to: if ; then echo $6$5 Not Found exit 8 fi I get error... (1 Reply)
Discussion started by: forevercalz
1 Replies

10. Shell Programming and Scripting

here-doc convert 2 script convert to single script?

I have my main script calling another script to retrive a "ls -alt" of a directory that's located in a remote location I'm sftping into. main.sh #!/bin/ksh getLS.sh > output.txt getLS.sh #!/bin/sh /home<..>/sftp <host@ip> <<! cd /some/dir/Log ls -alt quit ! Basically I'd like to be... (2 Replies)
Discussion started by: yongho
2 Replies

Featured Tech Videos