Bash alias for complicated ls command does not work.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash alias for complicated ls command does not work.
# 15  
Old 03-16-2010
Quote:
Originally Posted by gencon
[...]
Thanks again for all your help.
You're welcome!
# 16  
Old 03-16-2010
Managing functions

Hi.

I also like functions, but they can cause clutter and complexity. One way to address that is to use an autoload-like facility. Such a feature allows the functions to be placed in a separate directory, say ~/.functions, one function (or group of related functions) to a file. I think these ideas were first found in ksh.

Regrettably, autoload is not built into bash. However, you may have access to a set of functions that perform that task. In my main workstation system (Debian 5, lenny), these functions are in:
Code:
/usr/share/doc/bash/examples/functions

in the filenames containing the string autoload.

I have used them with (most recently) GNU bash 3.2.39 and they seem to work correctly.

So whenever you create a new function, or you find something interesting on the 'net, you can just drop the file in .functions, and you'll be set.

Looking briefly over my examples, the functions in .functions can be made to work with ksh (and probably zsh, but I have not tried that), assuming no bashisms are present.

Best wishes ... cheers, drl
# 17  
Old 03-16-2010
You already have been provided fine solutions by radoulov, but I whipped this up in case it's of interest:
Code:
alias lf="ls -l | sed -n '/^-/s/^\([^ ]* *\)\{8\}//p'"

or
Code:
alias lf="ls -l | grep ^- | tr -s ' ' | cut -d' ' -f9-"

Cheers,
Alister
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Alias does not work with bash profile

Hi, Below is what i have in my profile: alias wldm='cd /opt/app/wls' If i use bash or ksh shell this alias does not work. What should be done for this alias to work with all these simultaneously -> No Shell, bash shell, and ksh shell (14 Replies)
Discussion started by: mohtashims
14 Replies

2. UNIX for Dummies Questions & Answers

Using alias to create subshell and work in it

using kerberos to access remote server. first I execute kshell to create subshell and then kinit username@domain in that subshell. After that it prompts to enter password. Since I need to do this over and over, I am trying creating alias. I tried kshell; kinit username@domain. Did not work,... (7 Replies)
Discussion started by: analyst
7 Replies

3. Shell Programming and Scripting

complicated exclude option in find command

Hi all, In a directory, I have many video files. Example : As you can see, some of the video files come with a .aspx file (wich means the video is actually being uploaded and not entirely written on the FS) I try to write a bash script that would find all video files in the ... (1 Reply)
Discussion started by: gniagnia
1 Replies

4. UNIX for Dummies Questions & Answers

A very simple script, but alias won't work

I am new to unix and therefore I did a lot of reading before posting. So please, if this has been answered before, forgive me for re-posting and point me to the right place for the answer. I have spent many hours searching the net and read over 50 posts in this forum and even tried a few thing but... (20 Replies)
Discussion started by: sssccc
20 Replies

5. Shell Programming and Scripting

complicated alias command

hi guys i m making one alias which will set variable , invoke sqlplus and also set prompt of sqlplus,,i have made successfully upto invoking sqlplus in unix but cant pass command in sqlplus here is the command alias sett='export ORACLE_SID=devdb2;sqlplus system/system@test' now this... (3 Replies)
Discussion started by: tapia
3 Replies

6. Linux

Complicated Join command!

Hi I have a serious issue when trying to join to files so I have two files, one for meals and one for people Meal1:Turkey:Potato Chips:Twinkie:Coke:5.95 Meal2:Ham & Cheese:Doritos:Cookie:Sprite:6.49 Meal3:Vegetarian:Cheese Crackers:Brownie:Pepsi:5.75 Meal4:Tuna:Cheese Puffs:Eclair:Diet... (1 Reply)
Discussion started by: ehshi1992
1 Replies

7. Shell Programming and Scripting

Global alias does not work in shell script

Hi Linux Set up - alias ls='ls -l' Then run script #! /bin/ksh sub() { ls } sub Is there any way to get it working. I don't want to define alias inside of the program Thank you (2 Replies)
Discussion started by: zam
2 Replies

8. UNIX for Dummies Questions & Answers

Alias, function or script (bash) to "revert" cd command?

In all of my brief and superficial experience with Unix or Linux, the one curious and consistent thing has been that 'cd ./' (back up one directory level) has done absolutely nothing in any of them. Now I understand that, at least for bash, 'cd ./' appears to have been substituted by 'cd ..' Am... (1 Reply)
Discussion started by: SilversleevesX
1 Replies

9. Shell Programming and Scripting

alias doesn't work

Hi I have put alias ll='ls -la' in .profile file but it doesn't work. On hand it works it looks like the .profile file is not beeing read. How to check whitch file is loaded? ,profile? .bash_profile? My system: SunOS mion 5.10 Generic Shell: /bin/pfksh Thanks (2 Replies)
Discussion started by: miojamo
2 Replies

10. UNIX for Dummies Questions & Answers

more command does not work in bash shell

is there a different command to display contents of a file on the output in bash shell? i tried more and it does not work. (7 Replies)
Discussion started by: npatwardhan
7 Replies
Login or Register to Ask a Question