Bug 166955
Summary: | echo ignores \c to supress newlines | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Frank Farance <frank> |
Component: | bash | Assignee: | Tim Waugh <twaugh> |
Status: | CLOSED NOTABUG | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 4 | ||
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2006-01-19 10:05:41 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Frank Farance
2005-08-28 21:29:18 UTC
I've done a little more research. On FC3, the "echo" built-in of "ksh" got it right. The main problem is that it is difficult to write a shell script that is portable across the UNIX/Linux systems. Even if one uses "-e" in "/bin/echo", the problem becomes: $ echo -e "abcdef\c" is not portable across UNIX systems. I am aware that there might be some issues concerning backward compatibility (e.g., someone's broken sense of "echo" that is now behaving properly). Unlike other commands that can take arguments to customize, the "echo" command shouldn't take any arguments. One way to allow it to customize itself would be through environment variables, such as: $ ECHO_ARGS="-e --"; export ECHO_ARGS $ echo "abcdef\c" The above use of ECHO_ARGS would mean: - "-e" means expand the backslash characters - "--" means no more arguments, i.e., "echo" will not interpret any of its arguments. Aside from "/bin/echo" supporting this $ECHO_ARGS feature, the shell built-ins in sh, bash, ksh, and pdksh should support this, too. It is unrealistic that all the shell scripts have to change (and in a non-portable, non-standard way) just so they run on Linux systems. The above solution approach allows script developers to have a common startup/environment file, while not having to create Linux-specific scripts. Seems like: shopt -s xpg_echo is what you're after. |