LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-13-2010, 04:08 PM   #1
kopper27
Member
 
Registered: Nov 2009
Posts: 147

Rep: Reputation: 16
characters issue on screen


hi guys

I am working on a menu for some linux machines

I created the menu - someone else did for me - this way

Code:
opciones ()
{
loop=true
while $loop
do
  echo "                  Menu Opciones"
  echo "                  ==============\n\n"
  echo "               1. Despliega usuarios por grupo"
  echo "               2. Bajar / Subir Servicios "
  echo "               3. Bajar / Subir Servicios "
  echo "               4. Reiniciar / Bajar / Subir Servicios "
  echo "               5. Reiniciar / Bajar / Subir Linux HeartBeat"
  echo "               6. Ejecutar comando"
  echo "\n              99. Salir"
  echo "\n\n                    Opcion:\c "
  read opcion
  case $opcion in
    1) userxgrupo;;
    2) tamebservices;;
    3) wpsservices;;
    4) websealservices;;
    5) heartbeatservices;;
    6) tatservices;;
   99) loop=false;;
  esac
done
}
but in 4 linux servers I see it OK
I mean ok by spaces are fine, no \n or \c characters, prompt where is should be

http://i39.tinypic.com/jkzu3q.jpg

now check an screen from another Linux Box which I don't understand why is it displayed like that

http://i42.tinypic.com/1695jxu.jpg

any idea how to fix it on these 2 linux boxes?

thanks a lot
 
Old 04-13-2010, 05:32 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Are they all running the same distro/version?

Did the file get created on all of them in the same way (e.g.,
copied from one place using the same method)?
 
Old 04-13-2010, 05:56 PM   #3
kopper27
Member
 
Registered: Nov 2009
Posts: 147

Original Poster
Rep: Reputation: 16
yeah all of them are Red Hat Ent 5.0 yeah I used scp from one server to another

Last edited by kopper27; 04-13-2010 at 06:10 PM.
 
Old 04-13-2010, 07:48 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,251

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
On the two machines that are not working what happens in the following two scenarios:

1. Run the following at the command line: echo " ==============\n\n"

2. Place the same line above in a script and run it?

Might help us narrow down when and where the issue arises??

One other thing, are all the machines using the same shell?
 
Old 04-13-2010, 07:54 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
I wonder whether on some of the machines echo has been aliased to 'echo -e'

Normally I'd expect to see the \c and \n everywhere
 
Old 04-13-2010, 09:18 PM   #6
kopper27
Member
 
Registered: Nov 2009
Posts: 147

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by grail View Post
On the two machines that are not working what happens in the following two scenarios:

1. Run the following at the command line: echo " ==============\n\n"

2. Place the same line above in a script and run it?

Might help us narrow down when and where the issue arises??

One other thing, are all the machines using the same shell?
same result on both weird

Code:
#!/bin/sh
echo " "
echo " ==============\n\n"
echo " "


[root@issue ~]# ./script

 ==============\n\n

[root@issue ~]#

[root@good ~]# ./script

 ==============\n\n

[root@good ~]#




Quote:
Originally Posted by Tinkster View Post
I wonder whether on some of the machines echo has been aliased to 'echo -e'

Normally I'd expect to see the \c and \n everywhere
so how can I test that?


thanks a lot guys
 
Old 04-13-2010, 09:41 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
just enter 'alias|grep echo'
 
Old 04-13-2010, 09:52 PM   #8
kopper27
Member
 
Registered: Nov 2009
Posts: 147

Original Poster
Rep: Reputation: 16
alias in both systems are the same

Code:
[root@pacorwps ~]# alias
alias cp='cp -i'
alias l.='ls -d .* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
 
Old 04-13-2010, 10:43 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Next possibility: there's a function echo defined, or a script.

Code:
declare -F
Code:
file `which echo`
 
Old 04-14-2010, 11:22 AM   #10
kopper27
Member
 
Registered: Nov 2009
Posts: 147

Original Poster
Rep: Reputation: 16
I think I found something

on top it says
Code:
#!/bin/ksh
as soo as I change it to bash I got the issue on my other 4 servers

Code:
#!/bin/bash
so what does it mean?

looks like my 2 servers having issues don't support ksh
 
Old 04-14-2010, 03:55 PM   #11
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Change all of them to bash and add the -e to the echoes.
 
Old 04-15-2010, 02:03 AM   #12
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,251

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
Or you can check that 'ksh' is an option on the other two, ie see if /bin/ksh exists
and then change shells on those with "chsh"
 
Old 04-15-2010, 11:20 AM   #13
kopper27
Member
 
Registered: Nov 2009
Posts: 147

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by Tinkster View Post
Change all of them to bash and add the -e to the echoes.
Tinkster you really rock I changed the echo for echo -e "...." and works without problems on all 6 servers I left the ksh but I add the -e
 
  


Reply


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
screen does not display characters correctly derzok Linux - Software 1 11-03-2007 02:29 PM
multilanguage filename characters issue ovidnet Linux - Desktop 4 10-10-2007 04:10 PM
File Copy Issue-Special Characters fortezza Linux - Software 1 11-14-2005 08:16 AM
Special characters issue Agifem Linux - General 4 09-17-2003 01:42 PM
Having Password Speciall Characters on the screen JStew Programming 4 02-11-2003 01:27 PM


All times are GMT -5. The time now is 10:49 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration