Bug 1925961 - ksh and bash produce different results with same script
Summary: ksh and bash produce different results with same script
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: ksh
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Siteshwar Vashisht
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-02-07 18:10 UTC by Michael Carney
Modified: 2021-03-21 15:35 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-03-21 15:35:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
simple shell script using tr, head, and echo. (153 bytes, text/plain)
2021-02-07 18:10 UTC, Michael Carney
no flags Details

Description Michael Carney 2021-02-07 18:10:27 UTC
Created attachment 1755516 [details]
simple shell script using tr, head, and echo.

Description of problem: Running simple script fails under ksh, but succeeds under bash.


Version-Release number of selected component (if applicable):ksh-2020.0.0-4.fc33


How reproducible: Always


Steps to Reproduce:
1. Save attached script as "foo":
2. Run it using bash: sh ./foo
3. Run it using ksh: ksh ./foo

Actual results:

With bash: 

81> sh foo
ZR*33pQoES4P1fJLGz$F
82>

With ksh:

84> ksh foo
tr: ][=*: equivalence class operand must be a single character

85>

Expected results:

Both shells should run script successfully.


Additional info:

Comment 1 Kamil Dudka 2021-02-08 13:29:01 UTC
You need to write:

    tr -dc '...'

... instead of:

    tr -dc "'...'"


Note You need to log in before you can comment on or make changes to this bug.