Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I just tried this in ksh, and it didn't work. I'm having the same problem stated in my first post... "what it would do is list everything in the directory that was listed after "cdl", but it wouldnt actually go into that directory."
in .kshrc, i added:
alias cdl='cd $* | ls'
and it did the same thing...... it lists what's in the $* directory, but doesn't go into that directory. it's as if it's ignoring everything before ls, then just executing: ls directory_name
Keyphrase is "In bash, I was able to get it to work using:
[size=large]but this doesn't seem to work in ksh[/size]. in ksh, i also tried:"
That indicates he tried both using the ksh shell to me...
But as for you problem, I'm not sure why its not working for you, as I tested it on my own machine using the korn shell and it works with no problems..
Did you try typing it at the shell prompt to test?
shell prompt> alias cdl="cd $* | ls"
shell prompt> alias
After typing the command to set the alias, just type alias at the command line and it will list all your current alias's, see if it shows up in that list for ya or not to verify.
Originally posted by acid_kewpie drew.... why the fsck are you piping a cd into ls???
alias cdl='cd $*; ls'
or maybe better:
alias cdl='cd $* && ls'
That didn't work either. I tried both ways shown above, and what it does is go back to my home directory (as if it's reading the cd by itself). I also tried it with quotes around $*, and all it does is the same thing it's always done: ls the contents of the named directory, but never go into that directory.