Ok. This has got to be easy, but I can't get something right. I'm just trying to find a way to enter a few characters (example: cd1) and have it change my current directory. In other words, I'm at root and I want to type cd1 and have it be the same as if I typed "cd export/home/testuser". I'm using Solaris 8 for this. Thanks in advance for any help. I promise I'm trying to figure it out on my own...:)

Recommended Answers

All 4 Replies

If I understand right....

cd1.sh

#/bin/sh
cd /whateverdirectory/inhere

then, "chmod ugo+x cd1.sh"
Edit your profile, so it will always be in your path:
nano ~/.profile

You will see a list of paths seperated by colons. Add a colon, and then add the path to where you saved the script. Thus, you would add:
:/home/whateveryourusernameis

Hope this is what you wanted.

If I understand right....

cd1.sh

#/bin/sh
cd /whateverdirectory/inhere

then, "chmod ugo+x cd1.sh"
Edit your profile, so it will always be in your path:
nano ~/.profile

You will see a list of paths seperated by colons. Add a colon, and then add the path to where you saved the script. Thus, you would add:
:/home/whateveryourusernameis

Hope this is what you wanted.

Thanks for replying. I tried something similar:

#!/bin/sh
cd /directory/sub-directory

chmod + x cd1.sh

Then, did ./cd1 to see if it worked. It didn't. I'll try the script without the "!". Thanks.

try an alias:

alias home="cd /home/budroeducom"
alias cd1="cd /some/longpath/to/somewhere"

typing

home

will execute

cd /home/budroeducom

To see what alias commands are already there:

alias

will list them for you.

I had thought about the alias before (at home) and it didn't work. I tried it at work and it was fine. I'll try it at home again and I bet it will work. I must have missed some syntax. I'm all good now. Thanks to those who replied.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.