Sponsored Content
Top Forums UNIX for Dummies Questions & Answers [Solved] Korn Shell execution Post 302829569 by kumarjt on Friday 5th of July 2013 08:08:28 AM
Old 07-05-2013
[Solved] Korn Shell execution

There are two Korn Shell scripts :
script_1.ksh ( located in /home/dir1 )
script_2.ksh ( located in /home/dir2 )
Content of script_2.ksh is
Code:
#!/usr/bin/ksh
echo "Hello world.."

The script_2.ksh is called from within script_1.ksh using the following command :
Code:
./home/dir2/script_2.ksh

but the "Hello world.." is not printed .
Error shown is :./home/dir2/script_2.ksh: not found

But , if a SPACE is added in between the dot and forward slash for command , the script works fine.
ie.,
Code:
. /home/dir2/script_2.ksh

Why is it so ?
How does the shell interpret this command , but aborts with the previous one ?
Please explain.
Thanks
Kumarjit
OS : Linux 2.6x

Last edited by vbe; 07-05-2013 at 09:14 AM.. Reason: extra code tags...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

korn shellscript execution context - exit statement

Hi all, Could someone please explain to me the shell invocation process when running a script. How do I stop the shell from logging out when it reaches an exit statement in the script? if ; then echo 'Failed to copy ${FILE}.fmx to ${J2_HOME}/dev/rsc' ... (3 Replies)
Discussion started by: richgi
3 Replies

2. Shell Programming and Scripting

how to convert from korn shell to normal shell with this code?

well i have this code here..and it works fine in kornshell.. #!/bin/ksh home=c:/..../ input=$1 sed '1,3d' $input > $1.out line="" cat $1.out | while read a do line="$line $a" done echo $line > $1 rm $1.out however...now i want it just in normal sh mode..how to convert this?... (21 Replies)
Discussion started by: forevercalz
21 Replies

3. Shell Programming and Scripting

Korn Shell Script help required during execution...

Hi, The following Korne Shell script does not give any syntax errors but the following while running. Request you to please let me know, how can I define the variables viz.:- listDbs and getkey here, inorder to remove the error. 1) $ ksh -n setAlias $ 2) $ ksh -x setAlias +... (1 Reply)
Discussion started by: marconi
1 Replies

4. Shell Programming and Scripting

How to activate Korn Shell functionnalities in Bourne Shell

Hi All I have writing a Korn Shell script to execute it on many of our servers. But some servers don't have Korn Shell installed, they use Borne Shell. Some operations like calculation don't work : cat ${file1} | tail -$((${num1}-${num2})) > ${file2} Is it possible to activate Korn Shell... (3 Replies)
Discussion started by: madmat
3 Replies

5. UNIX for Dummies Questions & Answers

[Solved] execution problem

Hi I want to make a script . In this script i want to use input file and this input file consist of three numbers in a line for example input file is as below: 919876543210 09876543234567876 98764534245678 aircelmms","aircelweb","aircelwap" 096574235625... (2 Replies)
Discussion started by: esumiba
2 Replies

6. Shell Programming and Scripting

[SOLVED] Capturing output in a korn variable

Hi, I'm new to korn and having trouble capturing the text output from one program in an array that I can then feed into another program. Direct approaches didn't work, so I've tried to break it down thus: The program lonlat2pixline gives the values I need in the second column, so I print that... (4 Replies)
Discussion started by: daurin
4 Replies

7. UNIX for Dummies Questions & Answers

[solved]Korn, disabling * substitution

If I execute the following line of code: echo "*" I get a list of files in the current directory. What if all I wanted to do was display the asterisk itself? What does the code have to look like so all I get is an asterisk? Thanks ahead of time for your assistance ----------... (3 Replies)
Discussion started by: Wreckoning
3 Replies

8. Shell Programming and Scripting

[Solved] Command execution in Makefile

Linux Gurus, I have a query regarding the execution of a complex command in the makefile of the current system. I am currently using shell command in the makefile to execute the command. However my command fails as it is a combination of a many commands and execution collects a huge data...... (4 Replies)
Discussion started by: satishkumar432
4 Replies

9. Shell Programming and Scripting

[Solved] Issue with using for loop as for in {2..6} in korn shell

Hi i have to cut columns 2 to 6 from a file and assign it to arrays , The following code works for ctcol in 2 3 4 5 6; do set -A a$ctcol $(cut -d, -f $ctcol test_file) done how ever this does not work for ctcol in {2..6}; do set -A a$ctcol $(cut -d, -f $ctcol test_file)... (4 Replies)
Discussion started by: 100bees
4 Replies

10. Shell Programming and Scripting

[Solved] How to refer more than 9 command line inputs for a scripts in korn shell?

Hi all, I have a script which should take more than 9 command line inputs while running. Likescript.sh a s d f g h j j k l o p i u y t r e w Now in the script if I have to access one of the input which is at position after 9, in this case say 'p' then how can I do that? echo $12 will not work... (15 Replies)
Discussion started by: pat_pramod
15 Replies
shell_builtins(1)                                                                                                                shell_builtins(1)

NAME
shell_builtins, case, for, foreach, function, if, repeat, select, switch, until, while - shell command interpreter built-in commands The shell command interpreters csh(1), ksh(1), and sh(1) have special built-in commands. The commands case, for, foreach, function, if, repeat, select, switch, until, and while are commands in the syntax recognized by the shells. They are described in the Commands section of the manual pages of the respective shells. The remaining commands listed in the table below are built into the shells for reasons such as efficiency or data sharing between command invocations. They are described on their respective manual pages. | Command | Shell alias |csh, ksh bg |csh, ksh, sh break |csh, ksh, sh case |csh, ksh, sh cd |csh, ksh, sh chdir |csh, sh continue |csh, ksh, sh dirs |csh echo |csh, ksh, sh eval |csh, ksh, sh exec |csh, ksh, sh exit |csh, ksh, sh export |ksh, sh false |ksh fc |ksh fg |csh, ksh, sh for |ksh, sh foreach |csh function |ksh getopts |ksh, sh glob |csh goto |csh hash |ksh, sh hashstat |csh history |csh if |csh, ksh, sh jobs |csh, ksh, sh kill |csh, ksh, sh let |ksh limit |csh login |csh, ksh, sh logout |csh, ksh, sh nice |csh newgrp |ksh, sh nohup |csh notify |csh onintr |csh popd |csh print |ksh pushd |csh pwd |ksh, sh read |ksh, sh readonly |ksh, sh rehash |csh repeat |csh return |ksh, sh select |ksh set |csh, ksh, sh setenv |csh shift |csh, ksh, sh source |csh stop |csh, ksh, sh suspend |csh, ksh, sh switch |csh test |ksh, sh time |csh times |ksh, sh trap |ksh, sh true |ksh type |ksh, sh typeset |ksh ulimit |ksh, sh umask |csh, ksh, sh unalias |csh, ksh unhash |csh unlimit |csh unset |csh, ksh, sh unsetenv |csh until |ksh, sh wait |csh, ksh, sh whence |ksh while |csh, ksh, sh Bourne Shell, sh, Special Commands Input/output redirection is now permitted for these commands. File descriptor 1 is the default output location. When Job Control is enabled, additional Special Commands are added to the shell's environment. In addition to these built-in reserved command words, sh also uses: : No effect; the command does nothing. A zero exit code is returned. .filename Read and execute commands from filename and return. The search path specified by PATH is used to find the directory con- taining filename. C shell, csh Built-in commands are executed within the C shell. If a built-in command occurs as any component of a pipeline except the last, it is exe- cuted in a subshell. In addition to these built-in reserved command words, csh also uses: : Null command. This command is interpreted, but performs no action. Korn Shell, ksh, Special Commands Input/Output redirection is permitted. Unless otherwise indicated, the output is written on file descriptor 1 and the exit status, when there is no syntax error, is zero. Commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed. In addition to these built-in reserved command words, ksh also uses: * : [ arg ... ] The command only expands parameters. * .file [ arg ..Read the complete file then execute the commands. The commands are executed in the current shell environment. The search path specified by PATH is used to find the directory containing file. If any arguments arg are given, they become the posi- tional parameters. Otherwise, the positional parameters are unchanged. The exit status is the exit status of the last com- mand executed. the loop termination test. intro(1), alias(1), break(1), cd(1), chmod(1), csh(1), echo(1), exec(1), exit(1), find(1), getoptcvt(1), getopts(1), glob(1), hash(1), his- tory(1), jobs(1), kill(1), ksh(1), let(1), limit(1), login(1), logout(1), newgrp(1), nice(1), nohup(1), print(1), pwd(1), read(1), read- only(1), set(1), sh(1), shift(1), suspend(1), test(1B), time(1), times(1), trap(1), typeset(1), umask(1), wait(1), chdir(2), chmod(2), creat(2), umask(2), getopt(3C), profile(4), environ(5) 29 Jun 2005 shell_builtins(1)
All times are GMT -4. The time now is 06:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy