Question with read command in ksh


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Question with read command in ksh
# 1  
Old 07-29-2011
Error Question with read command in ksh

Hi,

I was writing a script to accept input using read. When I put !#/usr/bin/ksh in the beginning of the script, it accepts only 258 characters. And I remove it, it accepts more. I'm wondering what the difference is.

Thanks in advance,
# 2  
Old 07-29-2011
When you remove "!#..." you run a script in your current shell. I believe you can find your current interactive shell with "echo $SHELL".
# 3  
Old 07-29-2011
Actually I am aware of that. When I tried printing out that, it only gave me /usr/bin/ksh.

I just need my script to accept more than 258 characters like it does without #!/usr/bin/ksh.
# 4  
Old 07-29-2011
Hm... I don't understand then why it works different with #! and without.

Solaris has so many ksh-es (you are on Solaris, aren't you?). Try to find them all with "which -a ksh". I just check on linux (ksh-93t+), it works fine with strings of any length with and without "#!"

And 258 is a very arbitrary number...
Smilie
# 5  
Old 07-29-2011
Yes, I am on Solaris.

Here are the results from which -a ksh

Code:
no -a in . /usr/lib/nis /usr/bin /usr/ucb /etc /export/opt/SCsu/bin /usr/local/bin /usr/sbin /export/opt/SSHtectia/6.0.12_A1/sbin/ /export/opt/SSHtectia/6.0.12_A1/bin/ /export/opt/scripts /opt/oraClient/11.2.0.2/bin /masked_fs/vignette/addons/cryptix tclSSL.class /usr/ucb .

/usr/bin/ksh

# 6  
Old 07-29-2011
Ok (infamous unix differences):
Code:
type -a ksh

# 7  
Old 07-29-2011
Here it is.. (No option -a is available.)

Code:
ksh is /usr/bin/ksh

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh to read input until QUI

Hello all I'm looking to write a simple script (ksh/sh/bsh) to read user input and write it to a file (adding each time) until the user enters QUIT at which point I'm hoping to ask some more questions. Any help much apprecited (2 Replies)
Discussion started by: Grueben
2 Replies

2. Shell Programming and Scripting

While read -a line not working in ksh

while read -a line; this is not working in ksh. what is the equivalent of this in ksh. read: -a: unknown option (2 Replies)
Discussion started by: archana25
2 Replies

3. Shell Programming and Scripting

ksh while read issue

Hello, I have used a chunk of ksh script similar to this in many places without any issue: while : do print; read OPTION?"Enter a number (q to quit): " expr ${OPTION} + 1 >/dev/null 2>&1 CHECKVAL=$? if }" != ${OPTION} ]; then ... (2 Replies)
Discussion started by: port43
2 Replies

4. Shell Programming and Scripting

Variable to command to Variable Question KSH

Hello, First post for Newbie as I am stumped. I need to get certain elements for a specific PID from the ps command. I am attempting to pass the value for the PID I want to retrieve the information for as a variable. When the following is run without using a variable, setting a specific PID,... (3 Replies)
Discussion started by: Coyote270WSM
3 Replies

5. Shell Programming and Scripting

Read from Log file in Ksh

I have a log file like.. IMPORT from /dataserver/ftp/bits/mdr/mdr_data_discon.dat OF DEL ..... Number of rows read = 1376 Number of rows skipped = 0 Number of rows inserted = 1374 Number of rows updated = 0 Number of rows rejected = 2 Number of rows... (4 Replies)
Discussion started by: ramse8pc
4 Replies

6. UNIX for Dummies Questions & Answers

simple way to read an array in ksh

hi, I'm a newbie to shell scripting. I wanted to initialise an array using basic for loop and read it. Then i want to print it as a .CSV file.. Any help would me much appreciated.. (1 Reply)
Discussion started by: pravsripad
1 Replies

7. Shell Programming and Scripting

read values from ps -ef into variables in ksh?

Hi, I want to get the first two items returned by ps -ef into two variables? Can anyone please help Thanks (8 Replies)
Discussion started by: JamesByars
8 Replies

8. Shell Programming and Scripting

read from console in ksh

I am stuck with a problem while reading data from a file.. while do read line #do some operations and if some condition is satisfied, ask the user to enter his choice. # using the choice continue operations. done < fileBeingRead.txt The... (4 Replies)
Discussion started by: ajaykumarns
4 Replies

9. Shell Programming and Scripting

is there any way to read a line twice in KSH

Hi All, Is there any way to read the previous line in file reading ? or is there any way to read a line twice in KSH ? thanks in advance !! Srini (6 Replies)
Discussion started by: Srini75
6 Replies

10. Shell Programming and Scripting

ksh read timeout

any idea on how to timeout the read statement for ksh? for bash u can use read -t option -t timeout Cause read to time out and return failure if a complete line of input is not read within timeout seconds. This option has ... (2 Replies)
Discussion started by: ashterix
2 Replies
Login or Register to Ask a Question