Sponsored Content
Top Forums Shell Programming and Scripting Need assistance to resolve the KSH issue Post 302371714 by sathik on Monday 16th of November 2009 05:34:29 AM
Old 11-16-2009
Need assistance to resolve the KSH issue

am running the small script below.

count_a=48
count_b=48
if [$count_a -eq $count_b]; then
echo "Count matched"
else
echo "count not matched"
fi

I got the below output.

/bin/ksh: [48: not found
count not matched

It was giving the same error when I ran in another box. But I inculded /bin/ksh in the 1st line. Then It was working fine.
But same way I followed here also. even it is giving error.

And I tried the way also as I added #!/bin/ksh in the 1st line. But not favour.

my /bin/*sh output is given below.

-rwxr-xr-x 1 root other 703 Dec 16 2004 /bin/gnome-autogen.sh
-r-xr-xr-x 17 root bin 134 Jan 21 2005 /bin/hash
-r-xr-xr-x 1 root bin 735572 Jan 23 2005 /bin/bash
-r-------- 1 root bin 27752 Jan 23 2005 /bin/rsh
-r-xr-xr-x 2 root bin 159592 Jan 23 2005 /bin/pfcsh
-r-xr-xr-x 2 root bin 159592 Jan 23 2005 /bin/csh
-r-xr-xr-x 3 root bin 209256 Jan 23 2005 /bin/rksh
-r-xr-xr-x 3 root bin 209256 Jan 23 2005 /bin/pfksh
-r-xr-xr-x 3 root bin 209256 Jan 23 2005 /bin/ksh
-r-xr-xr-x 1 root bin 257288 Jan 23 2005 /bin/ssh
-r-xr-xr-x 1 root bin 363280 Jan 23 2005 /bin/tcsh
lrwxrwxrwx 1 root root 13 Jan 11 2006 /bin/jsh -> ../../sbin/sh
lrwxrwxrwx 1 root root 13 Jan 11 2006 /bin/pfsh -> ../../sbin/sh
lrwxrwxrwx 1 root root 13 Jan 11 2006 /bin/sh -> ../../sbin/sh
lrwxrwxrwx 1 root root 5 Jan 11 2006 /bin/remsh -> ./rsh
lrwxrwxrwx 1 root root 14 Jan 11 2006 /bin/zsh -> ../sfw/bin/zsh
lrwxrwxrwx 1 root other 28 Mar 2 2006 /bin/rpccp.sh -> /opt/OV/dce/bin_exe/rpccp.sh


Pls help me.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

KSH Script Assistance

Hey everyone, I'm newer than new when it comes to this ksh and scripting stuff, and unix in general. I have been thrown into a task at work that A: They expect me to come up to speed on, B: Show I can do this. (Program for the workgroup) Here's the script, part of it, from the overall... (3 Replies)
Discussion started by: Brusimm
3 Replies

2. UNIX for Dummies Questions & Answers

Can any good awk'er resolve this issue?

awk -F^ '{ if ((($1 != "M") && ($5 != "2")) || (($1 != "S") && ($5 != "7"))) print $0}' welcome > welcome1 The "&&" and "||" in the above command is not working with awk. When I run the above command, the same content of welcome is copied to welcome1 without any difference. Your reply is... (12 Replies)
Discussion started by: karthickrn
12 Replies

3. Shell Programming and Scripting

basename issue with ksh

I have a function name called help as below function help { echo "Run the script as," #echo "$(basename $0) -sod or -eod" echo "${0##*/} -sod or -eod" } and have case stmt which will call this function incase of wrong parameter but when ever I'm giving wrong... (2 Replies)
Discussion started by: manas_ranjan
2 Replies

4. Shell Programming and Scripting

ksh: How do I resolve ip addr in a text file?

Hi, I need to resolve IP to names in a text file. I was thinking of using some unix commands. Ksh. Text in file contains a lot of these entries: .. 20 6 <166>%ASA-6-302013: Built inbound TCP connection 12690562 for inside2:10.86.6.20/3678 (10.86.6.20/3678) to inside:10.107.22.12/1947... (3 Replies)
Discussion started by: hasselhaven
3 Replies

5. Shell Programming and Scripting

Need assistance with a file issue and a terminal issue

Hello everyone, I'm in need of some assistance. I'm currently enrolled in an introductory UNIX shell programming course and, well halfway through the semester, we are receiving our first actual assignment. I've somewhat realized now that I've fallen behind, and I'm working to get caught up, but for... (1 Reply)
Discussion started by: MrMagoo22
1 Replies

6. Shell Programming and Scripting

-z in ksh issue

Hi, Can any body please tell me what does -z do in ksh? I need to understand what does below code do? FILE_LIST is an array which store multiple number of files... if } ]]; then echo "EVDO file not found fi I hope I'm clear on my query (3 Replies)
Discussion started by: annybase
3 Replies

7. Solaris

Cannot resolve PTR record issue

Hi guys, I am currently receiving the following output in /var/log/syslog and is occurring every second leading to /var directory being full after every 2 days. Aug 20 17:32:29 opaldn1 sendmail: r7KCOlQm002517: ruleset=check_rcpt, arg1=<postmaster@silverapp6>, relay=, reject=450 4.4.0... (3 Replies)
Discussion started by: Junaid Subhani
3 Replies

8. Shell Programming and Scripting

Need assistance in ksh script

requirement : I need to read a text file and find out which particular line has highest charcters on it using the shell script. I tried & was able to find out only for one line. I could not able to find out for the entire the line. sed -n '10 p' ctstest.sh | wc -w Please guide me... (5 Replies)
Discussion started by: ramkumar15
5 Replies

9. 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
LKSH(1) 						    BSD General Commands Manual 						   LKSH(1)

NAME
lksh -- Legacy Korn shell built on mksh SYNOPSIS
lksh [-+abCefhiklmnprUuvXx] [-+o opt] [-c string | -s | file [args ...]] DESCRIPTION
lksh is a command interpreter intended exclusively for running legacy shell scripts. It is built on mksh; refer to its manual page for details on the scripting language. It is recommended to port scripts to mksh instead of relying on legacy or idiotic POSIX-mandated behav- iour, since the MirBSD Korn Shell scripting language is much more consistent. LEGACY MODE
lksh has the following differences from mksh: o lksh is not suitable for use as /bin/sh. o There is no explicit support for interactive use, nor any command line editing or history code. Hence, lksh is not suitable as a user's login shell, either; use mksh instead. o The KSH_VERSION string identifies lksh as ``LEGACY KSH'' instead of ``MIRBSD KSH''. o lksh only offers the traditional ten file descriptors to scripts. o lksh uses POSIX arithmetics, which has quite a few implications: The data type for arithmetics is the host ISO C long data type. Signed integer wraparound is Undefined Behaviour. The sign of the result of a modulo operation with at least one negative operand is unspeci- fied. Shift operations on negative numbers are unspecified. Division of the largest negative number by -1 is Undefined Behaviour. The compiler is permitted to delete all data and crash the system if Undefined Behaviour occurs. o The rotation arithmetic operators are not available. o The shift arithmetic operators take all bits of the second operand into account; if they exceed permitted precision, the result is unspecified. o The GNU bash extension &> to redirect stdout and stderr in one go is not parsed. o The mksh command line option -T is not available. o Unless set -o posix is active, lksh always uses traditional mode for constructs like: $ set -- $(getopt ab:c "$@") $ echo $? POSIX mandates this to show 0, but traditional mode passes through the errorlevel from the getopt(1) command. o lksh, unlike AT&T UNIX ksh, does not keep file descriptors > 2 private. SEE ALSO
mksh(1) https://www.mirbsd.org/mksh.htm https://www.mirbsd.org/ksh-chan.htm CAVEATS
lksh tries to make a cross between a legacy bourne/posix compatibl-ish shell and a legacy pdksh-alike but ``legacy'' is not exactly speci- fied. The set built-in command does not have all options one would expect from a full-blown mksh or pdksh. Talk to the MirOS development team using the mailing list at <miros-mksh@mirbsd.org> or the #!/bin/mksh (or #ksh) IRC channel at irc.freenode.net (Port 6697 SSL, 6667 unencrypted) if you need any further quirks or assistance, and consider migrating your legacy scripts to work with mksh instead of requiring lksh. MirBSD May 2, 2013 MirBSD
All times are GMT -4. The time now is 04:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy