Unexplained Text in Terminal

New to Debian (Or Linux in general)? Ask your questions here!

Unexplained Text in Terminal

Postby mac44mag » 2018-01-22 16:15

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
mac44mag
 
Posts: 1
Joined: 2018-01-22 15:38

Re: Unexplained Text in Terminal

Postby Head_on_a_Stick » 2018-01-22 17:09

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?
I'm old school like Happy Shopper
User avatar
Head_on_a_Stick
 
Posts: 7794
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Unexplained Text in Terminal

Postby debiman » 2018-01-23 07:35

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?
User avatar
debiman
 
Posts: 2609
Joined: 2013-03-12 07:18

Re: Unexplained Text in Terminal

Postby pendrachken » 2018-01-25 18:16

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
pendrachken
 
Posts: 1325
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.

Re: Unexplained Text in Terminal

Postby reinob » 2018-01-25 18:21

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).
reinob
 
Posts: 542
Joined: 2014-06-30 11:42

Re: Unexplained Text in Terminal

Postby pendrachken » 2018-01-25 21:21

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
pendrachken
 
Posts: 1325
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable