![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| whats wrong with this code | nadman123 | Shell Programming and Scripting | 4 | 04-15-2008 05:42 PM |
| tell me whats wrong with this | nadman123 | Shell Programming and Scripting | 1 | 04-14-2008 08:58 PM |
| tell me whats wrong in this? | nadman123 | Shell Programming and Scripting | 1 | 04-09-2008 10:11 PM |
| Whats wrong with this script? | kayarsenal | Shell Programming and Scripting | 2 | 08-25-2006 06:58 AM |
| whats wrong with this awk??? | george_ | Shell Programming and Scripting | 5 | 04-04-2006 01:58 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
First of all im using Bash, on a Debian-based machine. I tried to write a function that if the ls program found listed more than 25 lines I would automaticly use "ls | less". Its on another computer but if I recall it looked something like this...
Note: some code may look strange because im on this stupid spanish keyboard where nothing does as it says... Quote:
System crashed... Also tried assigning it to "lss" with the SAME problem (i think). System crashed... In despair i just tried to create an alias like: alias lss="ls -F | less" which only worked in the current directory.. also tried: lss="ls -F $@ | less" and lss="ls -F ${@:-$(pwd)}" Have no idea what to do... Regards Richard |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
You can't pass parameters to an alias that uses a pipe, so perhaps use a shell function instead. A function does not need an alias since you can just invoke it directly. Also, take a look at the manual pages for less. You might find that there is an option to quit if one screen.
|
|
#3
|
|||
|
|||
|
Code:
ls()
{
/usr/bin/ls
}
|
|
#4
|
|||
|
|||
|
ls | more
will work how you want |
|
#5
|
|||
|
|||
|
well the thing is that i want it to be automatic.. So i dont have to type a command TWICE when the screen gets filled... Thanks for your interest anyway...
|
|||
| Google The UNIX and Linux Forums |