A colon(':') of command line is replaced by blank

Solution Verified - Updated -

Environment

Red Hat Enterprise Linux 5

Issue

In bash of RHEL5, when colon(':') is specified for IFS, a colon of command line is replaced by blank.

 # A=a
 # B=b
 # C=c
 # IFS=:
 # echo $A:$B:$C
 a b c
 #

Resolution

Please enclose a character string including colons with a double quotation marks.

 # A=a
 # B=b
 # C=c
 # IFS=:
 # echo "$A:$B:$C"
 a:b:c
 #

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

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