Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Unexplained Text in Terminal

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
mac44mag
Posts: 1
Joined: 2018-01-22 15:38

Unexplained Text in Terminal

#1 Post by mac44mag »

My apologies if this has been answered elsewhere, but if it has, I have not yet found it.

I'm running Gnome3 on Stretch (latest update).

I've hosed my terminal screen. When I open a Terminal, I get the following text displayed above my prompt:

"bash: cat file1.txt file2.txt | tee unsorted.txt | sort unsorted.txt -r > reversed.txt: command not found" (no quotes)

I've looked at .bashrc and .bash.bashrc, and the text is not in there.

Where can I go to try and get rid of the text? Is it somehow or other being included as part of the $PS1?

Thank you for any help you may be able to give, and once again, sorry for the newbie question.

Leonard

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Unexplained Text in Terminal

#2 Post by Head_on_a_Stick »

mac44mag wrote:I've looked at .bashrc and .bash.bashrc, and the text is not in there.
I think it's probably best to post your ~/.bashrc here so that we can check it.

Post the bash.bashrc as well but only if you've changed it (no reason why you would).

Does the message appear if you start (for example) xterm instead?
deadbang

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Unexplained Text in Terminal

#3 Post by debiman »

mac44mag wrote:"bash: cat file1.txt file2.txt | tee unsorted.txt | sort unsorted.txt -r > reversed.txt: command not found" (no quotes)
wouldn't that mean that bash cannot find the cat command? that would be weird indeed.
yes, we need to find out where that line comes from.
is it only in gnome-terminal or in all terminal emulators?

pendrachken
Posts: 1394
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.

Re: Unexplained Text in Terminal

#4 Post by pendrachken »

debiman wrote:
mac44mag wrote:"bash: cat file1.txt file2.txt | tee unsorted.txt | sort unsorted.txt -r > reversed.txt: command not found" (no quotes)
wouldn't that mean that bash cannot find the cat command? that would be weird indeed.
yes, we need to find out where that line comes from.
is it only in gnome-terminal or in all terminal emulators?

Depends on the modification. Using ticks instead of quotes in the script would cause bash to literally look for the command "cat file1.txt file2.txt | tee unsorted.txt | sort unsorted.txt -r > reversed.txt" as the whole command name ( including spaces ), instead of parsing it cat $1 $2 then piping the output to tee...... etc. etc.



That said, just as a cursory think about it why not use

Code: Select all

 cat file1 file2 | tac > ReversedList

To get rid of the interim files and the unneeded sort of said files? It doesn't seem to be looking for unique names / numbers or anything, literally just sorting the files into reverse order.
fortune -o
Your love life will be... interesting.
:twisted: How did it know?

The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches :-P

reinob
Posts: 1189
Joined: 2014-06-30 11:42
Has thanked: 97 times
Been thanked: 47 times

Re: Unexplained Text in Terminal

#5 Post by reinob »

pendrachken wrote: That said, just as a cursory think about it why not use

Code: Select all

 cat file1 file2 | tac > ReversedList

To get rid of the interim files and the unneeded sort of said files? It doesn't seem to be looking for unique names / numbers or anything, literally just sorting the files into reverse order.
tac will reverse the lines as they are in the files.
The quoted command line reverse *sorts* the lines.
It's not the same, unless the files were already sorted (in combination).

pendrachken
Posts: 1394
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.

Re: Unexplained Text in Terminal

#6 Post by pendrachken »

Whoops, seems like I mis-remembered how sort -r worked. I thought it was just a rewrite of tac, where it would only reverse the list.


Anyways, just subbing in the sort -r for tac would still cut down on the command length and complexity:

Code: Select all

cat file1 file2 | sort -r > file3
Added bonus you don't need to write anything to disk until you write file 3. This takes away the need to read two files > write a file > read the file > then sort the file > write to another file.

Instead you get: read two files > sort the read info directly > write a file. Much faster on larger volumes of data than rewriting and re-reading the data constantly. Smaller data set sizes won't see a lot of gain by cutting the I/O bloat, but larger ones certainly will.
fortune -o
Your love life will be... interesting.
:twisted: How did it know?

The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches :-P

Post Reply