07-08-2005
#!/usr/bin/ksh Command Interpreter in a sh script
Hi,
I have a developer that is trying to start a script with sh "scriptname". In the script, he is specifying #!/usr/bin/ksh as the command interpreter. For some reason sh is ignoring the #!/usr/bin/ksh. We are running Solaris 8. Does anyone have any ideas what could be causing this? Here is the script:
#!/usr/bin/ksh
#--create test file to read
#
echo "1" > test_file
echo "2" >> test_file
echo "3" >> test_file
#--WHILE READ should populate variables when shell contains #!/usr/bin/ksh
#
record_cnt=0
initial="OUTSIDE"
while read record ##--placed into $record
do
record_cnt=`expr $record_cnt + 1`
initial="INSIDE"
echo "Records Read=$record_cnt”
done < test_file ##--input file to be read
echo " "
echo "Records Read=$record_cnt"
echo "Initial=$initial"
exit 0
8 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am using IBM AIX unix version 4.3.3.0.
In a directory there are many files with different patterns.
When I am trying to execute the command, ls -l with the file pattern, which have fewer files it gives the desired result. However when I am trying to execute the same command for file pattern,... (2 Replies)
Discussion started by: jitindrabappa
2 Replies
2. Tips and Tutorials
Introduction
Originally, we only had one shell on unix. When ran a command, the shell would attempt to invoke one of the exec() system calls on it. It the command was an executable, the exec would succeed and the command would run. If the exec() failed, the shell would not give up, instead it... (3 Replies)
Discussion started by: Perderabo
3 Replies
3. Shell Programming and Scripting
Hi ,
My shell script doesnt function properly while executing.
My shell script has the below mentioned code in it.
#!/bin/sh
CD="/usr/bin/cd"
..
..
$CD /
..
..
main intention behind giving the $CD / is to replace the cd command with /usr/bin/cd at the time of program execution.
... (5 Replies)
Discussion started by: raghu.amilineni
5 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I have a problem I don't understand with fuser.
I launch a simple shell script mysleep.sh:
I launch the command fuser -fu mysleep.sh but fuser doesn't return anything excepted:
mysleep:
Then I modify my script switching from #!/bin/sh to #!/bin/ksh
I launch the command fuser -fu... (4 Replies)
Discussion started by: Peuj
4 Replies
5. Shell Programming and Scripting
Usually we use !/usr/bin/ksh at the start of the script.But if I am having this stuff in the scripts and calling one script from other its not working.What may be the reason behind it ?
xyz.ksh
#!/usr/bin/ksh
echo "Hi"
abc.ksh
#!/usr/bin/ksh
echo "I am fine"
ksh xyz.ksh
Its... (4 Replies)
Discussion started by: dr46014
4 Replies
6. AIX
Hi,
I am getting the below error message When i am trying to delete the files from the directory.Could you please guide me?
rm *.aud
ksh: /usr/bin/rm: 0403-027 The parameter list is too long.
and
find /oracle/admin/testP/adump/*.aud -mtime +5 -exec rm {} \;
ksh: /usr/bin/find:... (3 Replies)
Discussion started by: nokiae63
3 Replies
7. Shell Programming and Scripting
I saw one script using the first line as below
/usr/bin/ksh -E
I have used -x for debug but couldn't find what is this -E option for ?
Pls let me know what is this -E used for
Thanks
RL (1 Reply)
Discussion started by: reldb
1 Replies
8. Shell Programming and Scripting
I keep getting this error and I am not sure why.
-bash: ./p4: /bin/ksh^M: bad interpreter: No such file or directory
First I run my makefile and this works fine:
goodmain: main.o
gcc -o goodmain main.o
main.o: main.c
gcc -c main.c
Then I want to limit my output so I... (11 Replies)
Discussion started by: cokedude
11 Replies
print(1) User Commands print(1)
NAME
print - shell built-in function to output characters to the screen or window
SYNOPSIS
ksh
print [ -Rnprsu [n]] [arg...]
DESCRIPTION
ksh
The shell output mechanism. With no flags or with flag - or -, the arguments are printed on standard output as described by echo(1).
OPTIONS
The following options are supported:
-n suppresses new-line from being added to the output.
-R
-r (raw mode) ignore the escape conventions of echo. The -R option will print all subsequent arguments and options other than
-n.
-p causes the arguments to be written onto the pipe of the process spawned with |& instead of standard output.
-s causes the arguments to be written onto the history file instead of standard output.
-u [ n ] flag can be used to specify a one digit file descriptor unit number n on which the output will be placed. The default is 1.
EXIT STATUS
The following exit values are returned:
0 Successful operation.
>0 Output file is not open for writing.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
echo(1), ksh(1), attributes(5)
SunOS 5.10 15 Apr 1994 print(1)