Problems with using less


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Problems with using less
# 1  
Old 07-13-2009
Problems with using less

Hello,

I am having problems with using less on

Linux version 2.6.18-92.1.17.el5 (brewbuilder@hs20-bc1-7.build.redhat.com) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)). I am using csh but have the same problems on bash.

If I pipe something to less it works perfectly i.e. cat file | less

However if I do, less file, nothing happens apart from getting a new prompt line that doesn't display what I'm typing. If I type exit and press enter then I get the less output.

I was using less 394 and compiled less 429 on my system, but it had the same problem.

I looked on the less page FAQ (Less FAQ) but couldn't find anything useful.

Anybody have any idea what's wrong?

Many thanks,

Dave
# 2  
Old 07-14-2009
When on the receiving end of a pipe less generates output. With less filename you have to play with ^V the space bar and so on. You are in interactive mode.

It's behavior depends on the terminal "type" of stdin. In a script or on the receiving end of a pipe, stdin is not a terminal. less uses termcap based on terminal type to determine base behavior when it is entered on the command line.

I'm guessing this is what you are asking.
# 3  
Old 07-14-2009
Thanks Jim for the reply. I got your point of less behaving differently when executed directly from the terminal and when piped.

I am confused about what you mean by interactive mode. I can get into interactive mode, only when I pipe stdin to less. But when I execute less directly from the terminal, the screen is seemingly frozen and I can't get into interactive mode. When I say that the screen is seemingly frozen, I mean my typing isn't displayed, the same behaviour when you type in password. I hope I haven't confused you.

I can get out of this "frozen stage" when I type exit and then I get into the interactive mode of less. It seems like when I type "less" I change the terminal control to not display what I'm typing.
# 4  
Old 09-17-2009
So finally I have found a solution.

It turns out that my default shell was set to csh, which is related to another thread I started https://www.unix.com/unix-dummies-que...#post302354325.

I asked the system admin to change the passwd file, so that my default shell was bash. So now less works again.

So there was something strange happening with my default shell and less.
# 5  
Old 09-17-2009
I am curious if their was a alias setup for less.

Can you see if any aliases were setup?

Code:
csh
alias less

# 6  
Old 09-17-2009
Hi Frank,

I compiled different versions of less and ran it with (-X, which is my favourite parameter) and without additional parameters and it had the same problems outlined above.

But no there weren't any aliases set up at the time I had my problems.

Do you see any correlation between the shell and less, which might have caused my problems?

Thanks for the reply again.

Dave
# 7  
Old 09-17-2009
Quote:
Originally Posted by z1dane
Do you see any correlation between the shell and less, which might have caused my problems?
no. that just sounds weird. are you 100% sure no aliases or wrapper scripts exist? Are there any less environment variables set only in csh? it's hard to say without more details but sounds like a possible environment issue.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

About ps -ef and if-else problems

I'm new in Shell Programming and Scripting, I would like to ask some questions. ps -ef | grep $appNAme | grep -v grep <-- what will it return when it find a process is running? return 1 or 0 if then exit 1 <--- if = 0 , run this ? else continue <--- if = 1 , run this ?... (5 Replies)
Discussion started by: LoAlex
5 Replies

2. Shell Programming and Scripting

If/then problems

#! /bin/bash # ask what the user would like to do CMD=$CMD MBA=$MB RS=$RS CT=$CT echo echo -n "What would you like to do?? REMEMBER WHEN PROGRAMMING ICP's TO SELECT CORRECT COMMAND ACCORDING TO NECCESSARY TYPE CODE! Please enter a command ct = program ctek ... (5 Replies)
Discussion started by: tdalyman
5 Replies

3. UNIX for Dummies Questions & Answers

Problems with IF Else ??!!

I have written the following code in cygwin to create directories in windows based on the parameter passed. echo $1 > fullpath path1=`awk -F / '{print $1}' $fullpath path2=`awk -F / '{print $2}' $fullpath if then if then if then continue ... (4 Replies)
Discussion started by: janardhanamk
4 Replies

4. SuSE

Problems!!

good friends I am new to linux and I have the following TELNET service problem entering data devo telnet to a Windows server 2003 server and passes will not let me since the move to this server by telnet tells me the characters and thus invalidates me income, I have a service application... (1 Reply)
Discussion started by: pepetico
1 Replies

5. Shell Programming and Scripting

Problems with $?

Hello, I have the following piece of code that tries to retrieve the result of a .sh: . $HOME/prueba/Scripts/Recogida/recogida_sedra.sh resultado=$? echo "el resultado es : $resultado" if ; then echo "Se va a preprocesar los archivos" In the code of recogida.sh I have the... (8 Replies)
Discussion started by: danietepa
8 Replies

6. UNIX for Dummies Questions & Answers

problems with If

I'm having problems uses "if" it works fine when i do this. #!/bin/sh a= 10 qw= 2 w= 20 { if && ;then echo 3 fi } However if i try to do #!/bin/sh a= 10 (5 Replies)
Discussion started by: THM
5 Replies

7. UNIX for Advanced & Expert Users

Problems with Last

Hi, I,ve a Unixware 7.1.3 working correctly for two years ago, since a several weeks I've a problem with the command last . The information that this command return is : For example : 1.- The user root , time login : 12:15 h, time logoff 12:15 h (the real time is 14:00). Connected time is... (3 Replies)
Discussion started by: By_Jam
3 Replies

8. UNIX for Dummies Questions & Answers

Few problems

Hi how can i do this? 1) shell script which writes data and time on to a file if filesystem exceeds 70% of space. 2) make entry to cron table to run a script every 15 mins. and can anyone expplain or demonstrate the difference between variables used in inside a function and outside a... (3 Replies)
Discussion started by: vivekshankar
3 Replies

9. UNIX for Advanced & Expert Users

'make' problems (compliation problems?)

I'm trying to compile and install both most recent version of 'make' and the most recent version of 'openssh' on my Sparc20. I've run into the following problems... and I don't know what they mean. Can someone please help me resolve these issues? I'm using the 'make' version that was... (5 Replies)
Discussion started by: xyyz
5 Replies
Login or Register to Ask a Question