*Synopsis*: ksh93 script has problem with newline

     
*Change Request ID*: 6977405

*Synopsis*: ksh93 script has problem with newline

  Product: solaris
  Category: shell
  Subcategory: korn93
  Type: Defect
  Subtype: 
  Status: 1-Dispatched
  Substatus: 
  Priority: 4-Low
  Introduced In Release: 
  Introduced In Build: 
  Responsible Engineer: 
  Keywords: 

=== *Description* ============================================================
Such simple script like:

#!/bin/sh

set -vx
COMMAND="/usr/bin/echo 
-d passwd"

echo "$COMMAND"


has very strange output:

$ ./testbug.sh 
COMMAND="/usr/bin/echo 
-d passwd"

+ COMMAND=$'/usr/bin/echo \n-d passwd'
echo "$COMMAND"
+ echo $'/usr/bin/echo \n-d passwd'
/usr/bin/echo 
-d passwd


"$'/usr/bin/echo \n-d passwd' is different from other shells and it is used 
only in case that there is newline (and other shells probably).

>From ksh93 FAQ:

Q5.     What is the purpose of $'...'?
A5.     The $'...' option was added to ksh93 to solve the problem
        of entering special characters in scripts.  It uses
        ANSI-C rules to translate the string between the '...'.
        It would have been cleaner to have all "..." strings handle
        ANSI-C escapes, but that would not be backwards compatible.


Well, this is incompatible with other shells, misleading and awkward.

*** (#1 of 1): 2010-08-16 15:42:38 GMT+00:00 <User 1-1SURPB>


=== *Public Comments* ========================================================

=== *Workaround* =============================================================

=== *Additional Details* =====================================================
        Targeted Release: 
        Commit To Fix In Build: 
        Fixed In Build: 
        Integrated In Build: 
        Verified In Build: 
  See Also: 
  Duplicate of: 
  Hooks:
        Hook1: 
        Hook2: 
        Hook3: 
        Hook4: 
        Hook5: 
        Hook6: 
  Program Management: 
  Root Cause: 
  Fix Affects Documentation: No
  Fix Affects Localization: No

=== *History* ================================================================
        Date Submitted: 2010-08-16 15:42:38 GMT+00:00
        Submitted By: <User 1-1SURPB>

        Status Changed    Date Updated                  Updated By


=== *Service Request* ========================================================
        Impact: Significant
        Functionality: Primary
        Severity: 2
        Product Name: solaris
        Product Release: solaris_nevada
        Product Build: snv_145
        Operating System: snv_145
        Hardware: generic
        Submitted Date: 2010-08-16 15:42:38 GMT+00:00


=== *Multiple Release (MR) Cluster* - 0 ======================================

_______________________________________________
ksh93-integration-discuss mailing list
ksh93-integration-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/ksh93-integration-discuss

Reply via email to