Sponsored Content
Full Discussion: compile a shell script
Top Forums Shell Programming and Scripting compile a shell script Post 302268705 by zaxxon on Tuesday 16th of December 2008 06:49:23 AM
Old 12-16-2008
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.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to compile a stored procedure that is there with in a script file(.sql) in unix

Hi, How can i compile the procedure code that is there in a script file (.sql) in unix. (0 Replies)
Discussion started by: krishna_gnv
0 Replies

2. Shell Programming and Scripting

Help - Bug: A script to compile two types of data files into two temporary files

Dear other forum members, I'm writing a script for my homework, but I'm scratching all over my head and still can't figure out what I did wrong. Please help me. I just started to learn about bash scripting, and I appreciate if anyone of you can point out my errors. I thank you in advance. ... (3 Replies)
Discussion started by: ilove2smoke
3 Replies

3. UNIX for Dummies Questions & Answers

Unable to compile Shell Script

Hi there, I have written the shell script to illustrate arithmetic operations using case command as shown below: #!/bin/bash echo -n "Enter any two numbers :" read a read b MENU=" Select any one option 1) Addition 2) Substraction 3) Multiplication 4) Division 5) Quit" clear $x=0;... (5 Replies)
Discussion started by: grc
5 Replies

4. Programming

Makefile includes and shell environment during compile

Below is the top of my Makefile. On one machine, I have mysql_config5, and another, I have mysql_config. In my .bashrc file of one UNIX machine, I added an alias so that that mysql_config5 is mysql_config, however, when I do make, it doesn't use that environment and I get compile errors, unless I... (1 Reply)
Discussion started by: pyramation
1 Replies

5. UNIX for Dummies Questions & Answers

Compiling gcc to compile make to compile yaboot

I have just installed OpenBSD on a 333MHz PPC iMac G3. It has a 6GB HDD that has been partitioned as 1GB MacOS 8.5.1, 3GB MacOS X 10.3.9, 2GB OpenBSD 4.8. I now need to install a bootloader so that my computer can recognize the OpenBSD partition at startup. I have been trying to install... (0 Replies)
Discussion started by: t04st3r
0 Replies

6. Shell Programming and Scripting

bash script to compile multiple .c files with some options

I'm trying to write a bash script and call it "compile" such that running it allows me to compile multiple files with the options "-help," "-backup," and "-clean". I've got the code for the options written, i just can't figure out how to read the input string and then translate that into option... (5 Replies)
Discussion started by: travis.batzer
5 Replies

7. Shell Programming and Scripting

How to compile or debug line by line in shell script?

I know about bash -x, set -x and -v but disappears from Command Line Interface in fraction of second ...... I am looking for a command or script ..complies each line and shows the output after executing each line ....( similar what we have in C ) Thanks in Advance (2 Replies)
Discussion started by: frintocf
2 Replies

8. Shell Programming and Scripting

Why doesn't this Bash shell compile directories?

Hello I'm having a problem trying to get this Bash shell program to function properly. Purpose: In the current directory, more into the sub-directories and compile the .c files. Heres my code: #!/bin/bash wd=$(pwd) for i do cd ${i} gcc *.c cd $wd done Then I save it... (8 Replies)
Discussion started by: murphy
8 Replies

9. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies

10. Programming

How to compile .sh script using g++?

Hi guys, Can you please help with compiling 123.sh file using g++? The idea is to make 123.sh not readable (make it kind of binary). Is there any idea ho to achieve this? (18 Replies)
Discussion started by: nypreH
18 Replies
jrunscript(1)						      General Commands Manual						     jrunscript(1)

NAME
jrunscript - command line script shell SYNOPSIS
jrunscript [ options ] [ arguments... ] PARAMETERS
options Options, if used, should follow immediately after the command name. arguments Arguments, if used, should follow immediately after options or command name. DESCRIPTION
jrunscript is a command line script shell. jrunscript supports both an interactive (read-eval-print) mode and a batch (-f option) mode of script execution. This is a scripting language independent shell. By default, JavaScript is the language used, but the -l option can be used to specify a different language. Through Java to scripting language communication, jrunscript supports "exploratory programming" style. NOTE: This tool is experimental and may not be available in future versions of the JDK. OPTIONS
-classpath path Specify where to find the user's .class files that are accessed by the script. -cp path This is a synonym for -classpath path -Dname=value Set a Java system property. -Jflag Pass flag directly to the Java virtual machine on which jrunscript is run. -l language Use the specified scripting language. By default, JavaScript is used. Note that to use other scripting languages, you also need to spec- ify the corresponding script engine's jar file using -cp or -classpath option. -e script Evaluate the given script. This option can be used to run "one liner" scripts specified completely on the command line. -encoding encoding Specify the character encoding used while reading script files. -f script-file Evaluate the given script file (batch mode). -f - Read and evaluate a script from standard input (interactive mode). -help Output help message and exit. -? Output help message and exit. -q List all script engines available and exit. ARGUMENTS
If [arguments...] are present and if no -e or -f option is used, then the first argument is the script file and the rest of the arguments, if any, are passed as script arguments. If [arguments..] and -e or -f option are used, then all [arguments..] are passed as script argu- ments. If [arguments..], -e and -f are missing, interactive mode is used. Script arguments are available to a script in an engine variable named "arguments" of type String array. EXAMPLES
Executing inline scripts jrunscript -e "print('hello world')" jrunscript -e "cat('http://java.sun.com')" Use specified language and evaluate given script file jrunscript -l js -f test.js Interactive mode jrunscript js>print('hello world'); hello world js>34 + 55 89 js> thread(function() { print('hello world'); } hello world js> Run script file with script arguments jrunscript test.js arg1 arg2 arg3 test.js is script file to execute and arg1, arg2 and arg3 are passed to script as script arguments. Script can access these using "argu- ments" array. SEE ALSO
If JavaScript is used, then before evaluating any user defined script, jrunscript initializes certain built-in functions and objects. These JavaScript built-ins are documented in jsdocs. 06 Aug 2006 jrunscript(1)
All times are GMT -4. The time now is 04:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy