ksh - typeset error

Solution Verified - Updated -

Issue

While I use typeset -i together with -RZ2, I'm getting usage error. Is this a bug in RHEL 6.3?

Our use case is to assign the output of date '+%m' command to THISMONTH and compute LASTMONTH and DELETEMONTH (4 months ago) from THISMONTH (that's why we want to treat it as integer) and later use LASTMONTH and DELETEMONTH in filenames we manipulate with tar and rm, so we need to assure it consists of exactly 2 digits padded with zero (this we want to assure with typeset -RZ2).

However using

typeset -iRZ2 THISMONTH
typeset -iRZ2 LASTMONTH
typeset -iRZ2 DELETEMONTH

leads to usage error:

Usage: typeset [-bflmnprstuxACHS] [-a[type]] [-i[base]] [-E[n]] [-F[n]] [-L[n]] [-R[n]] [-X[n]]
               [-h string] [-T tname] [-Z[n]] [name[=value]...]
   Or: typeset [ options ] -f [name...]

Environment

  • Red Hat Enterprise Linux (RHEL) 6.3
  • ksh-20120801-10.el6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.