recent test -e ksh incompatibility in hpux?

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting recent test -e ksh incompatibility in hpux?
# 1  
Old 06-10-2011
recent test -e ksh incompatibility in hpux?

On a very new (11.31) hpux machine, I can no longer execute shell fragements like:

if [ -e ] ; then
and get "ksh: test: argument expected"

if I convert this to -d or -f as appropriate (which I've not had to do on older versions of hpux (11.23) nor any other unix platform I've tried (aix, linux, sun)).

Is -e something that is considered a non-portable ksh construct?
# 2  
Old 06-10-2011
I thought ksh used built in test -- try bash, it has it! My hpux (old) man test has no -e, -e fails like that. But /bin/test likes it! sh -c likes it!

Last edited by DGPickett; 06-10-2011 at 05:27 PM..
# 3  
Old 06-10-2011
Originally Posted by DGPickett
I thought ksh used built in test
The shell message is from test, and yes this is probably the builtin. Regardless, the question remains. I've not had any such problem with ksh on other Unixes, nor the older hpux versions.

The suggestion to use bash is not very helpful, since it's not installed on this machine.
# 4  
Old 06-10-2011
It is easy to get from the uk hp binary archive. Porting And Archive Centre For HP-UX
ksh93 looks OK. try dtksh from the CDE dir, it's ksh93+.
# 5  
Old 06-10-2011
I'm not positive that it's actually using the test built-in. On some shells [ ] isn't a built in while [[ ]] is. What if you use [[ ]]?
# 6  
Old 06-10-2011
The [ ] is the official form supported by posix and -e is supposed to work. So the test is standard and portable. Something is broken on your new system. I would check with HP to see if a patch exists.
# 7  
Old 06-10-2011
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to convert string(variable) into date( epoch) in ksh on HPUX machine?

Hi all, I have used a bash script which ultimately converts a string into date using date --date option: DATE=$DATE" "$TIME" "`date +%Y` //concatenating 2 strings TMRW_DATE=`date --date="$DATE" +"%s"` //applying date command on string and getting the unixtime Please use code tags... (7 Replies)
Discussion started by: Rashu123
7 Replies

2. HP-UX

HPUX KSH for loop issues.

Wrote a KSH script on a RHEL server and moved it over to the HPUX server and it is not liking a loop that I put together. Here is the simple form of it that does not work in KSH: for x in {0..$VARIABLE_NAME} do echo $x done This works: for x in {0..10} do echo $x ... (3 Replies)
Discussion started by: jake0391
3 Replies

3. Shell Programming and Scripting

Mail cleanup from ksh script, keeping 50 most recent msgs

I found some posts describing how to completely clean out a mailbox in Unix/Linux. But I want to keep the 50 most recent messages. Any ideas out there? Thanks! (3 Replies)
Discussion started by: OPTIMUS_prime
3 Replies

4. Shell Programming and Scripting

KSH: Test telnet and exit

Hi, I need to do a test Telnet in KSH and if the connection is good then disconnect the telnet session with out logging in and without exiting the shell script. Example output of a good connection: $telnet xxxx Trying Connected to Escape... (1 Reply)
Discussion started by: calex
1 Replies

5. UNIX for Dummies Questions & Answers

OpenSSH incompatibility with Sun SSH ??

I am using OpenSSH on my sun servers. There is another suite of sun servers attempting to SSH into my machines. I am running ssh -vv: OpenSSH_4.4p1, OpenSSL 0.9.8d 28 Sep 2006 the other guy is running the sun version of ssh (i don't know what/if any differences there are between... (7 Replies)
Discussion started by: EWTGPAC
7 Replies

6. UNIX for Dummies Questions & Answers

Ksh How to test if variable is numeric??

I'm trying to test and see whether a variable that is being extracted from a line in a file is numeric or not. I have tried everything that I can think of and I cannot figure out how to get it to work. I am trying to test and see if the string extracted contains 5 numeric digits. This is what I... (8 Replies)
Discussion started by: developncode
8 Replies

7. Shell Programming and Scripting

ksh scripting: Extract 1 most recent record for unique key

I'm loading multiple delimited files into an Oracle DB using sqlldr on Unix. I would like to get only the most recent record per each unique key. There may be multiple updates for each key, but I only want the most recent one. There is a date column in my delimited files, so I'm using cat to... (2 Replies)
Discussion started by: OPTIMUS_prime
2 Replies

8. Programming

Incompatibility an old c and gcc 4.3.1.urgency plz

I couldn't compile this code in gcc (SUSE Linux) 4.3.1 20080507. got me these! sniffer.c: In function ‘int CreateRawSocket(int)': sniffer.c:16: error: ‘htons' was not declared in this scope sniffer.c: In function ‘int BindRawSocketToInterface(char*, int, int)': sniffer.c:31: error: ‘bzero'... (2 Replies)
Discussion started by:
2 Replies

9. Shell Programming and Scripting

ksh - test if string contains alphanumeric...

Okay I will let users input spaces as well :) I am having a mental block. I have done a couple of searches but havent found anything that I understand (the likes of :alpha: and awk). Basically I want to give the user an option to enter some text which will go down as a field within a flat... (3 Replies)
Discussion started by: tugger
3 Replies

10. UNIX for Advanced & Expert Users

ksh read bug in HPUX 11i

Is this a bug in ksh on HPUX 11i or is read impromperly documented? INPUT Thu Jan 18 09:14:52 PST : CIFS: Virus Detected - File ONTAP_ADMIN$\vol\vol0\DDD\Ventana\Strattoni\Race Stuff\Rumor.exe in share DDD accessed by client CLIENT ( running as user USER is infected. The filer... (3 Replies)
Discussion started by: Jackaroe
3 Replies
Login or Register to Ask a Question