Problem with pipe and more

Forum rules
Before you post please read this

Problem with pipe and more

Postby fabrice91 on Tue Dec 17, 2013 11:20 am

Hi,

I'm working with an updated Linux Mint 14.
My shell is bash :
Code: Select all
echo $SHELL
/bin/bash


When I try this command on a text file named myFile.txt :

Code: Select all
cat myFile.txt

it works

Code: Select all
more myFile.txt

it works

Code: Select all
cat myFile.txt | more

Doesnt work ! (but working on a 12.04 Ubuntu)

I have this error :
Code: Select all
cat myFile.txt | more
 more : command not found


Same problem with "head" in place of "more"
Any explanation and solution ???
Thanx
fabrice91
Level 1
Level 1
 
Posts: 8
Joined: Tue Dec 03, 2013 11:14 am

Linux Mint is funded by ads and donations.
 

Re: Problem with pipe and more

Postby xenopeek on Tue Dec 17, 2013 11:28 am

What does:
Code: Select all
type more

say?
Forum Rules | IRC Channel Rules
Image
Arch Linux / 64-bit / Gnome Shell
User avatar
xenopeek
Level 21
Level 21
 
Posts: 13661
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Problem with pipe and more

Postby fabrice91 on Wed Dec 18, 2013 6:49 am

Code: Select all
type more
more is /bin/more


BUT !
I'm working at two different places and today I'm in another place than yesterday. And on my PC with the same Linux Mint 14, I dont have this problem !!!
I will try tomorrow on the other PC...
Thanx for your help
fabrice91
Level 1
Level 1
 
Posts: 8
Joined: Tue Dec 03, 2013 11:14 am

Re: Problem with pipe and more

Postby fabrice91 on Thu Dec 19, 2013 4:58 am

Hi, just testing on my other PC on which "more" doesn't work:
Code: Select all
type more
more is hashed (/bin/more)

I found explanation here :
http://www.ucs.cam.ac.uk/docs/course-no ... /notes.odt
It's like a PATH problem.
my PATH variable looks like this :
Code: Select all
echo $PATH
/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

So I unset the PATH and reset it :
Code: Select all
unset $PATH
PATH=/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

now :
Code: Select all
type more
more is /bin/more

But still the same problem :
Code: Select all
cat myFile.txt | more
more : command not found


If I change my shell from bash to sh, all is all right, the "cat myFile.txt | more" is working fine.

Thanx for help
fabrice91
Level 1
Level 1
 
Posts: 8
Joined: Tue Dec 03, 2013 11:14 am

Re: Problem with pipe and more

Postby fabrice91 on Thu Dec 19, 2013 5:28 am

So so strange, weird !
Is my Linux Mint cursed ??? :twisted:
I show the strange effect with my "more" command to my colleague.
I type the command line
Code: Select all
cat myFile.txt | more

in order to show him the strange result...but it works !!!
And I was in the same terminal as before !
I show him that on the same terminal, I had the previous error...
Totaly weird...
fabrice91
Level 1
Level 1
 
Posts: 8
Joined: Tue Dec 03, 2013 11:14 am

Re: Problem with pipe and more

Postby fabrice91 on Thu Dec 19, 2013 5:34 am

I restart my computer, now "more" is working as it does...
Dont know what happens...
Maybe the unset PATH resolve the issues by reseting the hash ???
I will go back here if problem start again.
But I you have an explanation, please tell me...
fabrice91
Level 1
Level 1
 
Posts: 8
Joined: Tue Dec 03, 2013 11:14 am

Re: Problem with pipe and more

Postby xenopeek on Thu Dec 19, 2013 6:10 am

No clue :) If the problem was still there I would have delved into it but seeing as it's fixed for you... The old "have your tried switching it off and on again?" seems to have done the trick :wink:
Forum Rules | IRC Channel Rules
Image
Arch Linux / 64-bit / Gnome Shell
User avatar
xenopeek
Level 21
Level 21
 
Posts: 13661
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Problem with pipe and more

Postby fabrice91 on Tue Jan 21, 2014 7:11 am

I found why this thing happen !
It's because I type fast on my keyboard !
To type a pipe | you must hold on the "Alt Gr" key, then the "6" in order to get a |
If you DONT release the "Alt Gr" and you type a space after the pipe, its NOT a space ! It seems to be a space on the screen but it is a special typo !
So you NEED to release the "Alt Gr" key before typing a space !
Or you may avoid to type a space after a | :
"cat /etc/bash.profile |more" instead of "cat /etc/bash.profile | more"
And this problem occurs with my Linux Mint and with an old ubutnu 10.04...
Hope this help...
fabrice91
Level 1
Level 1
 
Posts: 8
Joined: Tue Dec 03, 2013 11:14 am

Linux Mint is funded by ads and donations.
 

Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 3 guests