Will this be a problem in my script "#! /bin/ksh" ?


 
Thread Tools Search this Thread
Special Forums UNIX Desktop Questions & Answers Will this be a problem in my script "#! /bin/ksh" ?
# 1  
Old 04-19-2010
Will this be a problem in my script "#! /bin/ksh" ?

All,


In my script i am having the first line as

"#! /bin/ksh"

I see there is a space between #! and /bin ..

My script is working fine and it is not causing any problem.But some time this script is very slow in processing and even some time the script hangs we need to kill and reprocess . When we kill and reprocess it is processing. Is that is the reason becasue of space ????




Thanks in advance,
Arun
# 2  
Old 04-19-2010
No, the problem is unrelated. Probably. Since you did not post your code, I cannot say a lot more. Why? Because if your default shell is Bourne, some ksh-isms may possibly be syntactically correct but may not behave the same in bourne as in ksh.

However, more than likely you have some other performance problems. Or non-terminating loops. etc....
# 3  
Old 04-19-2010
Thanks jim,

THe script is very large and it call another c program and some more scripts . THis scripts is called from another C program

We are calling this as

sh -c "/US/bin/lending_upt 480 566 lend.cfg"

since we are using sh to execute this i thought the space might be the problem

THanks again
Arun
# 4  
Old 04-20-2010
You're running it with the wrong shell: it's a ksh script and you're running it with sh. run it with

Code:
ksh -c "/US/bin/lending_upt 480 566 lend.cfg"

When running scripts in this fashion, the #!/bin/ksh line doesn't do anything, it's just treated as a comment.
# 5  
Old 04-26-2010
I am novice at UNIX but I think if is possible you can set up few conditions

Let shell determine if is korn shell available on system if not , then install it , if everything passed well then continue with execution else echo "Please install Korn shell" .

Just an idea Smilie
# 6  
Old 04-29-2010
Quote:
Originally Posted by arunkumar_mca
since we are using sh to execute this i thought the space might be the problem
That line is ignored as a comment in your case as already stated and anyway, this space is never a problem. That's the other way around. Having no space between "#!" and "/bin/interpreter" might be a problem with some old Unix implementations so it is always safer to put one here. In any case, that space can never cause a performance issue.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Shell Programming and Scripting

Mindboggling difference between using "tee" and "/usr/bin/tee" in bash

I'm on Ubuntu 14.04 and I manually updated my coreutils so that "tee" is now on version 8.27 I was running a script using bash where there is some write to pipe error at some point causing the tee command to exit abruptly while the script continues to run. The newer version of tee seems to prevent... (2 Replies)
Discussion started by: stompadon
2 Replies

3. Shell Programming and Scripting

If cmd in in "A/user/bin A/bin A/user/sbin" but not "B/user/bin B/bin B/user/sbin" directory print t

there are two directories A and B if cmd in in "A/user/bin A/bin A/user/sbin" but not "B/user/bin B/bin B/user/sbin" directory print them (1 Reply)
Discussion started by: yanglei_fage
1 Replies

4. Shell Programming and Scripting

Purpose of "read" and "$END$" in ksh ?

Hi, Could anyone please shed some light on the following script lines and what is it doing as it was written by an ex-administrator? cat $AMS/version|read a b verno d DBVer=$(/usr/bin/printf "%7s" $verno) I checked that the cat $AMS/version command returns following output: ... (10 Replies)
Discussion started by: dbadmin100
10 Replies

5. UNIX for Dummies Questions & Answers

Difference between "/bin/bash" & "/bin/sh"

what if the difference between #!/bin/sh and #!/bin/bash I wrote a script with the second heading now when i change my heading to the first one ...the script is not executing well....im not getting the required output....any solution to this problem...or do i have to start the... (3 Replies)
Discussion started by: xerox
3 Replies

6. Shell Programming and Scripting

"#!/bin/ksh -f" What does the -f option do?

What does "-f" option do? This is at the start of a shell scripts to point to full path to the interpreter such as /bin/ksh What does the -f option do? #!/bin/ksh -f (3 Replies)
Discussion started by: Arsenalman
3 Replies

7. Shell Programming and Scripting

ERROR: "/bin/ksh: Not owner"

When ssh'ing into certain Unix boxes I'm seeing two errors that appear immediately after entering the password I've never seen. After the error message is displayed the connection closes immediately. The first is “/bin/ksh: Not owner” after which the connection is closed. And, “Read from remote... (5 Replies)
Discussion started by: twk
5 Replies

8. Shell Programming and Scripting

What does "#@$-s /usr/bin/ksh -x " mean?

I am using ksh.. Whenever we write a shell script the first statement would be #! /bin/ksh. But instead of that I came to find "#@$-q large" in the first line and"#@$-s /usr/bin/ksh -x " in the second line. what does it mean? Give your comments..... Thanks sabeer (4 Replies)
Discussion started by: sabeeralict
4 Replies

9. HP-UX

script running with "ksh" dumping core but not with "sh"

Hi, I have small script written in korn shell. When it is called from different script, its dumping core, but no core dump when we run it standalone. And its not dumping core if we run the script using "/bin/sh" instead of "ksh" Can some body please help me how to resolve this issue. ... (9 Replies)
Discussion started by: simhe02
9 Replies

10. UNIX for Dummies Questions & Answers

#!/bin/sh script fails at StringA | tr "[x]" "[y]"

I need to take a string (stringA) check it for spaces and replace any spaces found with an equal (=) sign. This is not working. There are spaces between each component: $StringA | tr "" "" The error returned is: test: Specify a parameter with this command Can you help? (3 Replies)
Discussion started by: by_tg
3 Replies
Login or Register to Ask a Question