The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
More than transposing! bulash UNIX Desktop for Dummies Questions & Answers 3 04-11-2008 05:20 PM
Transposing string unibboy Shell Programming and Scripting 3 02-13-2008 06:12 PM
Another transposing issue stevesmith Shell Programming and Scripting 14 09-16-2006 04:48 AM
file transposing mskcc Shell Programming and Scripting 24 08-04-2005 11:23 AM
transposing letters myscsa2004 Shell Programming and Scripting 4 05-12-2004 10:11 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-02-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
Point taken. It works in ksh and the so-called POSIX sh shell.
  #2 (permalink)  
Old 09-02-2008
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by Annihilannic View Post
Point taken. It works in ksh and the so-called POSIX sh shell.

The example I gave was in a standard POSIX shell; there it doesn't work.

If it works with /bin/sh, then /bin/sh is probably bash or ksh93.
  #3 (permalink)  
Old 09-02-2008
DeCoTwc DeCoTwc is offline
Registered User
  
 

Join Date: Mar 2008
Location: NYC
Posts: 74
Well if transposing is what you want...why not use the transpose command?
Quote:
cat file|tr "\n" " "
  #4 (permalink)  
Old 09-02-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
I was confused by this when I started to administrate HP-UX systems relatively recently. Their /bin/sh is distinct from the Bourne POSIX standard shell, it is apparently known as "the POSIX shell" and has a lot of ksh features (but not all). From the HP-UX 11.23 man page:

Quote:
The POSIX.2 standard requires that, on a POSIX-compliant system,
executing the command sh activates the POSIX shell (located in file
/usr/bin/sh on HP-UX systems), and executing the command man sh
produces an on-line manual entry that displays the syntax of the POSIX
shell command-line.

However, the sh command has historically been associated with the
conventional Bourne shell, which could confuse some users. To meet
standards requirements and also clarify the relationships of the
various shells and where they reside on the system, this entry
provides command-line syntax and a brief description of each shell,
and lists the names of the manual entries where each shell is
described in greater detail.

NOTE : The Bourne shell (/usr/old/bin/sh) is removed from the system
starting with HP-UX 11i Version 1.5. Please use the POSIX shell
(/usr/bin/sh) as an alternative.
What operating system were you testing on? The effect you see is what I'd have expected on Solaris, for example, where they seem to have a policy of retaining every piece of prehistoric paraphernalia they can (/usr/bin/awk is the one I find particularly frustrating).
  #5 (permalink)  
Old 09-02-2008
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by Annihilannic View Post
I was confused by this when I started to administrate HP-UX systems relatively recently. Their /bin/sh is distinct from the Bourne POSIX standard shell, it is apparently known as "the POSIX shell" and has a lot of ksh features (but not all).

A lot of features in ksh are not part of the POSIX shell specification. This is one of them.
Quote:
What operating system were you testing on?

That is irrelevant. I was testing with a standard POSIX shell; I could have had the same result on many systems.

$(<filename) is not part of the POSIX specification; it is an extension implemented by some POSIX shells, primarily bash and ksh93.
  #6 (permalink)  
Old 09-02-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
So it's safe to say that the /bin/sh that HP choose to call the POSIX shell is in fact a superset of POSIX, much like bash and ksh93.

I couldn't find the POSIX specification itself... unless SuSv3 is the same thing? I seem to find the terms used almost interchangeably. Anyway, as you say, SuSv3 says nothing about $(< ), nor does it mention brace expansion (test{1,2,3} becomes test1 test2 test3), which the shell in question also seems to support.

The Open Group -- the Single UNIX Specification Version 3

We digress.
  #7 (permalink)  
Old 09-02-2008
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by Annihilannic View Post
So it's safe to say that the /bin/sh that HP choose to call the POSIX shell is in fact a superset of POSIX, much like bash and ksh93.

It probably is one of those two.

What does /bin/sh --version return?

Quote:
I couldn't find the POSIX specification itself... unless SuSv3 is the same thing?

Yes.
Quote:
I seem to find the terms used almost interchangeably. Anyway, as you say, SuSv3 says nothing about $(< ), nor does it mention brace expansion (test{1,2,3} becomes test1 test2 test3), which the shell in question also seems to support.

Then it must be bash (or a more recent version of ksh93 than I have).
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:51 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0