running a script in korn shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting running a script in korn shell
# 1  
Old 12-27-2010
running a script in korn shell

I'm learning bash and have discovered that the shell can only work with integers and not decimals.

I'd like to run my scripts in korn to account for this, but just now, when I tried to run my script, I got an error message that said 'no such file or directory,' even though when I'm in the shell it lists it. Can someone tell me what I'm doing wrong?

While I'm here, how do I change shells -- in case I'm in bash and want to go to the korn shell, or vice versa?

Also, (I'm using OSX Snow Leopard), and how do I make or check that bash is the default shell to open in -- in the Preferences tab of the Terminal application, where it says run command, what should be in there (I think I may have done something there inadvertently). And how do I check to see which shell is currently running?

While I'm here, can someone remind me what command or pipe allows the user to break up a standard output when it exceeds the number of lines on the terminal?

Last edited by Straitsfan; 12-27-2010 at 08:15 PM..
# 2  
Old 12-27-2010
Just be sure to make your script executable:
Code:
chmod +x your_script

When changing shells just type:
Code:
bash

or
Code:
ksh

To know the default shell:
Code:
echo $SHELL

With regards to stdout, Just pipe it with "less" or "more"...
# 3  
Old 12-27-2010
I'm still getting the error message when I try to run the script. I'm typing 'source (scriptname)

And how do I delete characters? If I try to use tab to complete the line, there is a character at the end of the command/line that is highlighted, and I can't use fn+delete key to get rid of it -- I get some funny looking characters, and I eventually have to press enter and type the entire command.
# 4  
Old 12-27-2010
The most likely reason
Code:
source scriptname

failed is that "." is not in your path.
You can determine what is in your path by:
Code:
echo $PATH

If you want to just run the script with ksh, use:
Code:
ksh ./scriptname

(again, assuming that the script is in your current directory) instead of source scriptname..
Or, as previously posted, make the script executable and invoke it directly:
Code:
./scriptname

The script will have to start the correct "shebang" line:
Code:
#! /bin/ksh

or things won't work. More on shebang at Shebang (Unix) - Wikipedia, the free encyclopedia
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Korn Shell script in stopped state while running in background

Hi, I want to run a shell script in background . but its going to stopped state $ ksh cat_Duplicate_Records_Removal.ksh & 8975 $ + Stopped (tty output) ksh cat_Duplicate_Records_Removal.ksh & why is this happening? Also could anyone please tell me what is a stopped... (12 Replies)
Discussion started by: TomG
12 Replies

2. Homework & Coursework Questions

Korn Shell Script

1. The problem statement, all variables and given/known data: Write a korn shell script with an alfanumeric string as argument. The script lists the file's names in the current directory that contain the given string as substring and that can be read and written. 2. Relevant commands, code,... (3 Replies)
Discussion started by: burm
3 Replies

3. Shell Programming and Scripting

Korn Shell Script

I have to solve some exercises in Korn Shell, but i'm having some problems. For example: Write a korn shell script with an alfanumeric string as argument. The script lists the file's names in the current directory that contain the given string as substring and that can be read and written. I... (3 Replies)
Discussion started by: burm
3 Replies

4. Shell Programming and Scripting

Running a BATCH script from my korn script with multiparameters

I've this BATCH script to run from my korn script... The command is /usr/local/BATCH/runBatch.sh PARAM1 'PARAM2 -PARAM21 PARAM22' (runBatch takes parameter 1 = PARAM1 parameter 2 = 'PARAM2 -PARAM21 PARAM22' ) If i run this command from command line it just runs fine... ... (7 Replies)
Discussion started by: prash184u
7 Replies

5. UNIX for Dummies Questions & Answers

running script with korn shell

How would i instruct the current shell to run the current script using the korn shell? (1 Reply)
Discussion started by: JamieMurry
1 Replies

6. Shell Programming and Scripting

Running a Java Programm with a (korn)shell-script

hey everyone, For my studies i had to write a javaprogram which reads 2 integers from the keyboard and then using the basic operations(addition, division etc) with them. so far no problem. but now i gotta make a shell-script which: runs the program(compiled with javac) #!bin/ksh java... (1 Reply)
Discussion started by: simlmf
1 Replies

7. Shell Programming and Scripting

Shell running setup in Korn ?

I am starting to code a few ideas of customization and tasks improvements on the office UNIX machine. My first script (see below) only contains ALIAS commands. But for some reason, when I execute it, the alias are not executed. I suspect it is because of the "#!/bin/ksh" not being recognized or... (4 Replies)
Discussion started by: Browser_ice
4 Replies

8. Shell Programming and Scripting

Korn Shell script not running

I am sorry, this is really trivial, yet I am not able to understand what the problem is! I am using korn shell and running this script #!/bin/ksh keep=3 while ; do echo $keep keep=$(($keep-1)) done I am getting this error: `keep=$' unexpected I am not able to understand it because ... (1 Reply)
Discussion started by: Asty
1 Replies

9. AIX

Help with Korn Shell script

I have this Korn shell script that runs via a cron entry. It runs in a loop "watching" a specific file system for files with a certain name. The file system that it is watching is an upload file system for an FTP server. When files that are the correct name come in, it takes the extension of the... (1 Reply)
Discussion started by: heprox
1 Replies

10. UNIX for Dummies Questions & Answers

korn shell script

hello., i have 2 files.. 1 file is in this folder /home/test/ssk/DSA.WLG.20050713211544.20050710.20050713211544 (this part) other file is in this folder /home/kk/dev/DSA.WLG.20050711210100.20050710.20050711210100 ... (1 Reply)
Discussion started by: pavan_test
1 Replies
Login or Register to Ask a Question