Why statement works in LINUX and not UNIX?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Why statement works in LINUX and not UNIX?
# 8  
Old 10-30-2013
I don't know exactly why bash came up, since your question is about ksh. On Linux (if ksh is installed) this is typically a recent version of ksh93 which supports the =~ syntax, whereas on many UNIX versions the default ksh is still ksh88, which does not. Both the 88 and 93 version support the == syntax. On UNIX there may be a ksh93 version available but that depends on that particular OS and version.

Last edited by Scrutinizer; 10-30-2013 at 11:02 AM..
This User Gave Thanks to Scrutinizer For This Post:
# 9  
Old 10-30-2013
Quote:
Originally Posted by Scrutinizer
I don't know exactly why bash came up, since your question is about ksh. On Linux (if ksh is installed) this is typically a recent version of ksh93 which supports the =~ syntax, whereas on many UNIX versions the default ksh is still ksh88, which does not. Both the 88 and 93 version support the == syntax. On UNIX there may be a ksh93 version available but that depends on that particular OS and version.
Thank you! this was really helpful. It all makes sense now. My UNIX is ksh88.
# 10  
Old 10-30-2013
Quote:
Originally Posted by rdogadin
Thank you all for your replies. I guess one thing I am confused about is if I run my script under Korn Shell (#!/bin/ksh) on both unix and linux then why does it matter if I have BASH installed and what version of BASH I have?
Thanks
Not all versions of BASH have =~ either, just very new ones.

You are unlikely to have Korn installed on Linux unless you specifically ask for it to be installed, either.

KSH88 is a very popular variant of KSH for some reason, even though it lacks what I consider basic features ( i.e. substrings ).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Hardware

Does this hardware works with Linux

Hello folks, I pretend acquire this hardware: 1-Motherboard Asus Skt1151 - H110M-A/M.2 (https://www.asus.com/pt/Motherboards...cifications/); 2-Intel i5 6400 2.7Ghz QuadCore Skt1151; or 2-Intel i5 6500 3.2Ghz QuadCore Skt1151; 3-Dimm 8GB DDR4 Kingston CL15 2133Mhz; Obvious I pretend... (1 Reply)
Discussion started by: enodev
1 Replies

2. Shell Programming and Scripting

Convert Update statement into Insert statement in UNIX using awk, sed....

Hi folks, I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex. I have a bunch of update statements with all columns in a file which I need to convert into insert statements. UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies

3. Shell Programming and Scripting

Script works with Linux not with Solaris

Hi I have the following script which works in Linux shell but gives issues with Sun OS Solaris 5.10, What i am trying to achieve here is we have a list of file names in list.txt file and we parse each file at a time for a particular pattern and copt next 4 lines after we hit the pattern to a... (6 Replies)
Discussion started by: Yugendra
6 Replies

4. Shell Programming and Scripting

sed works on Linux and Unix does not work

Hi, I use this command in Linux but if I run the same command does not work in freebsd. Follow the below command: Linux works: sed -e '1731a\' -e '####' squid.conf > squid2.conf ; sed -e '1731a\' -e 'acl TESTE_ip src 192.168.1.1/255.255.255.255' squid2.conf > squid.conf ; sed -e... (7 Replies)
Discussion started by: andreirp
7 Replies

5. Shell Programming and Scripting

awk -F works on Linux, but not on Solaris

Hello, I found this command works on Linux: $ echo `uptime` | awk -F "load average: " '{ print $2 }' 1.60, 1.53, 1.46 but got error on Solaris: $ echo `uptime` | awk -F "load average: " '{ print $2 }' awk: syntax error near line 1 awk: bailing out near line 1 $ which awk... (2 Replies)
Discussion started by: seafan
2 Replies

6. Programming

question about how the if statement works

on C programming, on an if statement, if u have something like if A && B && C { } if A is false, will it still move on to B and check it? (1 Reply)
Discussion started by: omega666
1 Replies

7. Shell Programming and Scripting

Issue with script in linux but in unix works

I have this simple script: #! /usr/bin/sh #***************************************************************************** # *** get_input (question variable) *** #***************************************************************************** get_input () { echo "${BOLD}${1} : " read... (14 Replies)
Discussion started by: C|KiLLeR|S
14 Replies

8. Programming

fcntl works in linux but not in mac os x

Hi, Unless I am missing some serious differences in Mac and linux in terms of C programming, I dont know why this would happen. Please take a look at the following piece of code fragment: bool add_input_to_db(Cons *new_data) { // Set the attributes of the lock struct flock fl =... (3 Replies)
Discussion started by: newhere
3 Replies

9. UNIX for Dummies Questions & Answers

what's the Linux|Unix OSes works on Servers

Hi everybody , I'm new here in the forum and new Dummy in L|U systems (Hope finding welcomes...:)). I just want to ask : What is the OS's that works on servers and the OS's that work as client OS?? I just know that Solaris Work on sarvers :D.. and i'm glad to be memmber in this... (1 Reply)
Discussion started by: derbi
1 Replies

10. Shell Programming and Scripting

Script works on Solaris, not on Linux

I'm in the same boat as Barbus - same exercis (https://www.unix.com/shell-programming-scripting/43609-processes-users.html) The following script works on a solaris server I have access to. It doesn't however, work on the companies Linux machine. Any idea what's up? I have very little shell... (0 Replies)
Discussion started by: Silverhood
0 Replies
Login or Register to Ask a Question