Thanks a lot, your tip works, but now I have a new problem: the colors
are gone when I run the command. For example, when you run 'ls', there
are different colors to distinguish the folders, text files,
executables, etc, but it's all only one color now (in my case green
because my setup is green on black). How can I make the different colors
appear?

Serban Giuroiu
--------------
> > Hello. I've written a short shell script to change my directory and 
> > display the contents at once because I'm sick of having to do 'cd dir' 
> > then 'ls -l'. My problem is that once the program is done executing, my 
> > directory remains the same. Here's my script:
> >
> > #!/bin/bash
> > cd $1
> > ls -lh | more
> >
> > How can I solve this problem?

> 
> The shell invoked by the script is the one doing the cd'ing.  Not your
> shell.
> 
> A better faster and generally cool way to do this sort of thing is
> with functions in your .bashrc (or other login init files)
> 
> For the the functionality you wanted above it would look like this:
> 
>     cdl () { cd $1;ls -lh|more; }
> 
> NOTE: The spaces after/before {} are important.
>       The `;' after `more' is vital too.
> NOTE: `cdl' is just an arbitrary name.  It could be anything.
> 
> With that in .bashrc you would have a new command at the prompt.
> 
> Type: `cdl dir'
> 
> And presto: moved and listed.
> 
> In order to get it into your environment as you write it, you will
> need to source .bashrc after inserting the line like:
> 
> source ~/.bashrc
> 
> You should be able to cut and paste the line above to get the idea of
> what it will do. 
> 
> Just put it in a file named test for now, to see what it does.
> (remember to source what ever file you put it in)
>  source test  
> or  
>  . test



Get your own FREE E-mail address at http://www.linuxfreemail.com
Linux FREE Mail is 100% FREE, 100% Linux, 100% better, and 100% yours!




_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to