LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-08-2004, 08:14 AM   #1
fsbooks
Member
 
Registered: Jan 2002
Location: Missoula. Montana, USA
Distribution: Slackware (various)
Posts: 458

Rep: Reputation: 42
behaviour of echo with ? (the question mark) in gnome-terminal


I have the following script which isolates a problem I have been having:

#!/bin/bash
ps -C sleep -f|tr -s ''|grep sleep|head -n1
ps -C sleep -f|tr -s ''|grep sleep|head -n1|while read rec
do
echo $rec
done
exit

The results differ depending on the gnome-terminal window in which they are started.

Window 1:

$ /tmp/pstest
chris 15214 7874 0 06:43 ? 00:00:00 sleep 3934
chris 15214 7874 0 06:43 ? 00:00:00 sleep 3934
$ echo 06:43 ?
06:43 ?

Window 2:
$ /tmp/pstest
chris 15214 7874 0 06:43 ? 00:00:00 sleep 3934
chris 15214 7874 0 06:43 h m 00:00:00 sleep 3934
$ echo 06:43 ?
06:43 h m

As you can see, it seems to all come down to echo - which somehow decides that in some instances the ? means I need to be told something (that 06 is hours and 43 is minutes) I certainly do not. I am guessing it is some idiotic gnome option that presumes the computer is smarter than I am, since the behaviour differs from window to window (I believe at the moment that new windows give the second wrong result, windows started w/X as part of the session seem to give the first), but certainly shopts are the same in the bash shell.

Just upgraded to fedora core 1 from RH 9.0 with most available updates applied. I have bash-2.05b-34 (GNU bash, version 2.05b.0(1)-release (i386-redhat-linux-gnu)). gnome is 2.4 (gnome-terminal-2.4.0.1-1).
 
Old 01-08-2004, 12:41 PM   #2
fsbooks
Member
 
Registered: Jan 2002
Location: Missoula. Montana, USA
Distribution: Slackware (various)
Posts: 458

Original Poster
Rep: Reputation: 42
OK, I figured this out.

It just so happens that I have not been running this program in my $HOME directory. I happen to have a directory called h and one called m in $HOME. A new shell in in $HOME, therefore, echo interpretes the ? as h and m, which I, being "smarter" than the computer, decided was hours and minutes. So I fixed my script and things are cool. Learn something everyday.
 
  


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
Question about Nautilus and GNOME-terminal darkarcon2015 Linux - Software 3 02-12-2006 07:28 PM
Prevent Terminal Echo Using Python (for Passwords) taylor_venable Programming 4 07-05-2005 11:52 PM
Why does my penguin have a question mark? beejayzed General 5 03-23-2004 05:23 PM
iptables mark question paulos Linux - Networking 0 01-21-2004 07:20 AM
Significance of Occasional Blue Question Mark on Tux J.W. LQ Suggestions & Feedback 2 10-23-2003 07:26 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:08 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