How to create short form for directories?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to create short form for directories?
# 1  
Old 01-16-2008
Question How to create short form for directories?

Hi Friends,

Can you please tell me how to create short form for directories?
like,

this is a directory: /usr/tmp/progs/scripts
when i give cd $short_name, it should take to the above path.

in which env setting do i have to set?

Thanks,
Rashmy.
# 2  
Old 01-16-2008
Code:
short_name=/usr/tmp/progs/scripts

# 3  
Old 01-16-2008
for bash at least:

Code:
CDPATH=./:<PATH TO BASEDIR>

should work - i.e. will let you cd to dir's within BASEDIR

or if that's not quite what you mean, use ln to make a link....
# 4  
Old 01-16-2008
Use the link command ... it's easier.
# 5  
Old 01-26-2008
are these commands scope is upto session?

i want that short_variable to be exist for any session..
# 6  
Old 01-26-2008
Error

Hi,

I believe that the ln command would help solve your problem.

you could try using the following command:

ln -s /usr/tmp/progs/scripts <any name>

eg: ln -s /usr/tmp/progs/scripts ~/scrilink

so you can do : cd ~/scrilink

This is my first post in this forum. hope you find it useful.
# 7  
Old 01-26-2008
but the ln is used to create a link for files r8?

i want to do it for directory.

if i give cd $tmp
means

it should take me to the diectory defined in the tmp variable.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to create automated Directories

Hi, On serverB i wish to have a script that creates ONLY & EXACTLY the same folder structure that i provide on ServerA. Thus if serverA has a folder "Output" under /opt/app/Output and has the below folders under Output Output Output/logs Output/reciever Output/data... (11 Replies)
Discussion started by: mohtashims
11 Replies

2. UNIX for Dummies Questions & Answers

Create 2 directories in one command

Hi how can i create 2 directories in two different directories ($HOME and $PWD) with 1 command? dir 1 in $HOME and dir2 in $PWD (2 Replies)
Discussion started by: chinababy
2 Replies

3. UNIX Desktop Questions & Answers

Create/remove desktop short cuts via command line RHEL 6.3....

I would like to write a script that would remove and/or create shortcuts in Gnome desktop in RHEL 6.3... I googled all over the place could never find what I needed... Any help would be greatly appreciated! Thank you! (0 Replies)
Discussion started by: ruberked
0 Replies

4. Programming

help need in the perl script that create one xml file form multiple files.

Hi every one, Please excuse me if any grammatical mistakes is there. I have multiple xml files in one directory, I need to create multiple XML files into one XML file.example files like this</p> file1:bvr.xml ... (0 Replies)
Discussion started by: veerubiji
0 Replies

5. Shell Programming and Scripting

Create a multi user input form

Hi All, Please ignore if terminology used is incorrect as I am new to Unix. I want to create a Multi user input form which looks something like this: ABCD TOOL Logged User: abcd12 ... (4 Replies)
Discussion started by: vidhu0007
4 Replies

6. Shell Programming and Scripting

check if multiple directories exist else create missing directories

Hi , I 'm trying to check if multiple directories exist on a server, if not create the missing ones and print " creating missing directory. how to write this in a simple script, I have made my code complex if ; then taskStatus="Schema extract directory exists, checking if SQL,Count and... (7 Replies)
Discussion started by: ramky79
7 Replies

7. AIX

How to create short name for hostname

Such as one hostname: abcd1234, how to create a short name: a1? (4 Replies)
Discussion started by: rainbow_bean
4 Replies

8. Shell Programming and Scripting

mget * (obtein files from current directory but not the files form sub-directories)

Hello, Using the instruction mget (within ftp) and with "Interactive mode off", I want to get all files from directory (DirAA), but not the files in sub-directories. The files names don't follow any defined rule, so they can be just letters without (.) period Directory structure example: ... (0 Replies)
Discussion started by: Peter321
0 Replies

9. UNIX for Dummies Questions & Answers

How to create shotcuts to the directories

Hi, I need your help in writing shortcuts to my directories. So that I can go into the directories with the help of shortcuts. For example: there is a directory called /home/java/webapps/project1 I want to give a shortcut as project1 . So whenever I have give cd project 1 from command line ... (3 Replies)
Discussion started by: TonySolarisAdmi
3 Replies

10. UNIX for Dummies Questions & Answers

How to create directories

Hi... Can any1 help me by telling me the way to create multiple directories using single command.... to create 1 directory.. mkdir is used.... :D but how to create multiple direcs. like 4 direc. i tried .... $ mkdir a; mkdir b; mkdir c; mkdir d But its 4 commands in a single... (3 Replies)
Discussion started by: abishekmag
3 Replies
Login or Register to Ask a Question