LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 03-13-2007, 03:19 AM   #1
fangorn
LQ Newbie
 
Registered: May 2005
Distribution: Gentoo/Debian/AIX
Posts: 9

Rep: Reputation: 0
[Solved] change echo default setting to -e in Etch


Hi,

I have a problem with the default setting for "echo" command in Debian.

I have hundred of old scripts written for AIX and /bin/ksh. These I want to run in Debian Etch and /bin/ksh.

The Problem is, AIX "echo" command does not even know of the -e option. Therefore there is in none of the scripts a "echo -e " present when \ Escape sequences are used to echo non-printable characters.

ksh does not have an internal echo command, so it uses the system wide one. As Debian "echo" command defaults to -E (which ignores these Escape sequences and prints them as ASCII), I cannot run these scripts under Debian Etch.

I also cannot and do not want to change all the scripts to be echo -e instead of echo, as they still have to run on AIX (and other linux distributions). I would have to deeply edit any script and add a OS agnostic solution. Not an option.

Is there a switch to set to change that default behaviour?

I stumbled over some more or less dirty hacks to come around this.

- insert a script "echo" somewhere in the PATH before /bin (but what is before /bin in every PATH variable? not really a solution, unless deeply hacking into the system
- move /bin/echo to /bin/echo-bin and replace it with a script /bin/echo *shudder*
- remove ksh from the installation and replace it with a script that lauches a bash shell (which has an internal echo command that you can set the behaviour of) and sets the readline mode to vi. The users would probably never recognize the difference. But I am pretty sure some of the scripts will break
- recompile the package that provides echo command (think this has to be glibc) with more usable default settings *wild_shudder*

I would rather not use one of those "solutions". I think it is obvious why not.

So please show me what I am missing.

Thanks in advance for any tip,
fangorn


Edit: Problem solved [kinda].

pdksh provides an internal echo command with a more "compatible" behaviour. Lets see if some of the scripts crash.

Last edited by fangorn; 03-13-2007 at 08:31 AM.
 
Old 03-13-2007, 10:42 AM   #2
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 48
I'm not much of a shell scripter, but this part of your question has an easy solution -
Quote:
- insert a script "echo" somewhere in the PATH before /bin (but what is before /bin in every PATH variable? not really a solution, unless deeply hacking into the system
If you check /etc/profile, you'll see the default $PATH, and /bin is 3rd on that list. /usr/local/bin and /usr/bin are called before it gets to /bin.

Since you solved it on your own it isn't important, but /usr/local/bin is a great place for any account with a valid shell to hit first.

Peace,
JimBass
 
  


Reply

Tags
command, debian, defaults, echo, ksh, script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change the locale by setting the system default locale letdoit Slackware 6 08-18-2011 04:34 AM
How can you change the default setting for the "Run Command" program? whited Linux - General 6 03-01-2005 12:34 AM
How do i change the default 24bpp setting nenyo Linux - Newbie 2 01-17-2005 09:57 PM
How to change default font setting? boeckmann Linux - General 2 06-11-2004 06:38 PM
How do I change the default muted alsa setting in Core 2? enderjm Fedora 6 04-08-2004 01:35 PM


All times are GMT -5. The time now is 12:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration