Bug 1925961

Summary: ksh and bash produce different results with same script
Product: [Fedora] Fedora Reporter: Michael Carney <mwc>
Component: kshAssignee: Siteshwar Vashisht <svashisht>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 33CC: kdudka, svashisht, vmihalko
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-21 15:35:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
simple shell script using tr, head, and echo. none

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 "'...'"