OpenBSD sh and ksh differences?


 
Thread Tools Search this Thread
Operating Systems BSD OpenBSD sh and ksh differences?
# 1  
Old 08-07-2005
OpenBSD sh and ksh differences?

Hi,

I am running OpenBSD 3.7, my first attempt with this OS. I noticed that both /bin/sh and /bin/ksh are both really the pdksh. Yet each has its own manpage. I was wondering what are the differences b/w the two programs on OpenBSD. I.e., has the team configured pdksh to function one way if invoked as "ksh", while functionning differntly if invoked as "sh". (Compare GHU bash, which behaves slightly differntly when invoked as "sh".)

Thanks,
# 2  
Old 08-08-2005
# 3  
Old 08-08-2005
That's not what I was after. But I did find this in OpenBSD's sh man page:

Quote:
NOTES
sh is implemented as a run-time option of pdksh, with only those sh fea-
tures whose syntax or semantics are incompatible with a traditional
Bourne shell disabled. Since this leaves some sh extensions exposed,
caution should be used where backwards compatibility with traditional
Bourne or POSIX compliant shells is an issue.
So it indeed does function like bash, insofar that OpenBSD's modified version of pdksh checks if it has been invoked as "sh" or as "ksh", and adjusts accordingly. The only thing now is determning what presicely are those features that are disabled from their pdksh when it is invoked as sh. They should list them in the man page, but in fact they don't. One feature difference that I have spotted so far is that "sh" mode that does not support (( )) style arithmetic; you have to us let. (Though $(( )) arithmeatic expansion does work in "sh".)

Last edited by hadarot; 08-08-2005 at 07:51 PM..
# 4  
Old 08-08-2005
Indeed, here is a snippet OpenBSD's code (@ http://www.openbsd.org/cgi-bin/cvswe...bin/ksh/main.c):

Quote:
int
main(int argc, char *argv[])
{
....
....
kshname = *argv;
....
....

/* Check to see if we're /bin/sh. */
if (!strcmp(&kshname[strlen(kshname) - 3], "/sh") ||
!strcmp(kshname, "sh") || !strcmp(kshname, "-sh")) {
Flag(FSH) = 1;
version_param = "SH_VERSION";
}

Last edited by hadarot; 08-12-2005 at 04:59 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh / AIX - Differences between lists to a text file

This seems pretty simple, but I cant figure it out. I get stumped on the simple things. I am running two commands 1) take a listing a directory of files, and filter out the doc_name (which is in a series of extracted files), and place it in a file. ls -l | awk '{print $9}' | grep... (5 Replies)
Discussion started by: jeffs42885
5 Replies

2. UNIX for Advanced & Expert Users

Dot sourcing differences in ksh, AIX vs Linux vs Solaris

Why does dot sourcing of ksh functions behave so differently between AIX, Solaris, and Linux? How can I make Linux behave the way I want in the test I show below? I have a library of interdependent functions I have developed and use in ksh in AIX. They also run in Solaris. Now I am migrating... (9 Replies)
Discussion started by: charles_n_may
9 Replies

3. Shell Programming and Scripting

Manipulating field differences using ksh

I have a list of files that should contain the following Im trying to find the items of interest that are missing from each file and create a csv. cat *.txt | while read file do grep 3500 file | tr '\012' ',' done My problem is this possible output one.txt ... (2 Replies)
Discussion started by: popeye
2 Replies

4. Shell Programming and Scripting

Differences between 2 Flat Files and process the differences

Hi Hope you are having a great weeknd !! I had a question and need your expertise for this : I have 2 files File1 & File2(of same structure) which I need to compare on some columns. I need to find the values which are there in File2 but not in File 1 and put the Differences in another file... (5 Replies)
Discussion started by: newbie_8398
5 Replies

5. BSD

openbsd-pf

hello , I wondered if anyone could assist me in writing a simple packet filter firewall on my OpenBSD v4.5. All I intend doing is to have two firewalling machine on a separate network : 192.168.1.1 ext_if = xl0 (dhcp) // Internet interface int_if=xl1 // Internatl interface ... (0 Replies)
Discussion started by: mattjam
0 Replies

6. BSD

Trying to get into OpenBSD

I am an eight year Linux user and after getting into an argument with someone about OpenBSD overiding my theory that OS security is 50% OS and 50% admin skill, I decided to try OpenBSD for myself. I've tried BSDs before and haven't been able to get into them for day to dy use, but I am going to... (7 Replies)
Discussion started by: deckard
7 Replies

7. UNIX for Dummies Questions & Answers

OpenBSD: ports

Hi there.. I'm new to openbsd, and I recently tried the ports-system.. I downloaded the ports-tree from ftp, and unpacked it in /usr/ports Then I typed 'make search key=centericq' I got some info about it.. but it wasn't the latest version.. the version I use at my gentoo linux box, is... (6 Replies)
Discussion started by: Maestin
6 Replies

8. UNIX for Dummies Questions & Answers

OpenBSD: dircolors?

Hi, I'm wondering how I can get colors on the stuff that ls prints out in OpenBSD? //Maestin (4 Replies)
Discussion started by: Maestin
4 Replies

9. UNIX for Dummies Questions & Answers

OpenBSD installation

Hello I'm trying to install OpenBSD on my computer.. My partitions are these: wd0c : Where I have windows XP (NTFS) wd0j : Where I want to install OpenBSD (4.2BSD) wd0k: Where I have the installation files (Fat32) When the installation comes to the part where it mounts... (6 Replies)
Discussion started by: Hamcha
6 Replies

10. UNIX for Dummies Questions & Answers

please help with openbsd 2.9

Please help. I have downloaded the openbsd 2.9 snapshot from ftp.openbsd.org. the following files were downloaded from the snapshot dir. ( the whole dir. was downloaded ) base29,bsd,bsd.rd,cdrom29.fs,cksum,comp29,etc29,all three floppy images,game29,index,install.ata,install.chs... (11 Replies)
Discussion started by: Blunt_Killer
11 Replies
Login or Register to Ask a Question