compile a shell script | 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.

compile a shell script

Shell Programming and Scripting


Tags
compile, shell script, shell scripting, unix scripting, unix scripting basics

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-16-2008
panyam panyam is offline Forum Advisor  
Registered User
 
Join Date: Sep 2008
Last Activity: 24 July 2014, 3:48 AM EDT
Posts: 1,156
Thanks: 20
Thanked 104 Times in 99 Posts
compile a shell script

How can i compile a KSH shell script. I Dont want to execute it. I just need to compile it .

Any Help sincerly appreciated.
Sponsored Links
    #2  
Old 12-16-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
code tag tagger
 
Join Date: Sep 2007
Last Activity: 31 October 2014, 4:41 AM EDT
Location: St. Gallen, Switzerland
Posts: 6,237
Thanks: 121
Thanked 453 Times in 412 Posts
Get shc.
Sponsored Links
    #3  
Old 12-16-2008
panyam panyam is offline Forum Advisor  
Registered User
 
Join Date: Sep 2008
Last Activity: 24 July 2014, 3:48 AM EDT
Posts: 1,156
Thanks: 20
Thanked 104 Times in 99 Posts
no i can't go for Shc as it is not installed and i am not sure whether it is supported by ksh...

Any other way ?...
    #4  
Old 12-16-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
code tag tagger
 
Join Date: Sep 2007
Last Activity: 31 October 2014, 4:41 AM EDT
Location: St. Gallen, Switzerland
Posts: 6,237
Thanks: 121
Thanked 453 Times in 412 Posts
It is not supporting ksh? Where did you read that?


Code:
root@isau02:/data/tmp/testfeld> cat mach.ksh
#!/usr/bin/ksh

echo "Some menue"
echo

PS3="Choose a number: "

select CHOICE in one two three four quit
do
  case $CHOICE in
        one)    echo 1;;
        two)    echo 2;;
        three)  echo 3;;
        four)   echo 4;;
        quit)   exit ;;
        *)  echo "\nTry again\n";;
  esac
done

exit 0
root@isau02:/data/tmp/testfeld> ./mach.ksh
Some menue

1) one
2) two
3) three
4) four
5) quit
Choose a number: 2
2
Choose a number: 4
4
Choose a number: 5
root@isau02:/data/tmp/testfeld> shc -f mach.ksh
root@isau02:/data/tmp/testfeld> ll mach*
-rwx------ 1 root root   253 2008-12-16 12:43 mach.ksh
-rwx--x--x 1 root root  8444 2008-12-16 12:43 mach.ksh.x
-rw-r--r-- 1 root root 10725 2008-12-16 12:43 mach.ksh.x.c
root@isau02:/data/tmp/testfeld> ./mach.ksh.x
Some menue

1) one
2) two
3) three
4) four
5) quit
Choose a number: 2
2
Choose a number: 4
4
Choose a number: 5
root@isau02:/data/tmp/testfeld> file ./mach.ksh.x
./mach.ksh.x: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.1, dynamically linked (uses shared libs), for GNU/Linux 2.4.1, stripped

Seems it supports ksh. I used "select" which is not available in bash afaik.
Sponsored Links
    #5  
Old 12-16-2008
panyam panyam is offline Forum Advisor  
Registered User
 
Join Date: Sep 2008
Last Activity: 24 July 2014, 3:48 AM EDT
Posts: 1,156
Thanks: 20
Thanked 104 Times in 99 Posts
Hi Zaxxon ,

Thanks For the Reply.. as i said i can't go for Shc as it is not installed in my server . I am getting error message when i use shc.
Sorry for my misinterpretation that it is not supported by ksh.Since it is not installed in my server i thought wrong.
Sponsored Links
    #6  
Old 12-16-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
code tag tagger
 
Join Date: Sep 2007
Last Activity: 31 October 2014, 4:41 AM EDT
Location: St. Gallen, Switzerland
Posts: 6,237
Thanks: 121
Thanked 453 Times in 412 Posts
Yes I saw that you don't have it installed. But showing it works with ksh could have made you installing/compiling it or something so..
I know no alternative. Maybe write it in perl and compile it with perlcc or directly in C. Maybe someone else comes up with another suggestion.
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
How to compile or debug line by line in shell script? frintocf Shell Programming and Scripting 2 07-29-2011 07:36 AM
Compiling gcc to compile make to compile yaboot t04st3r UNIX for Dummies Questions & Answers 0 01-02-2011 09:20 PM
Makefile includes and shell environment during compile pyramation Programming 1 10-27-2010 03:12 PM
Unable to compile Shell Script grc UNIX for Dummies Questions & Answers 5 07-13-2010 03:25 AM
script to compile all libraries and forms myura Shell Programming and Scripting 4 11-10-2008 08:49 PM



All times are GMT -4. The time now is 10:59 AM.