problem with relative pathing


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers problem with relative pathing
# 1  
Old 01-17-2008
problem with relative pathing

Hi all,

My directory structure is as follows
home /md/DEV/SCRIPTS/DAILY and home/md/DEV/MIS/LANDING

so this command
find home/md/DEV/MIS/LANDING -name MIS_Customer_\*
is giving me the desired output
/home/md/DEV/MIS/LANDING/MIS_Customer_20080114.txt.
since i dont want to hardcode the path ie)home/md/DEV i opt for relative path like
find ../../MIS/LANDING -name MIS_Customer_\*.(since my scripts are in SCRIPTS/DAILY).because of this, am getting output
as
../../CIS/LANDING/MIS_Customer_20080114.txt which is undesirable.instead i want it like /home/md/DEV/MIS/LANDING/MIS_Customer_20080114.txt...pease help me to do this.or let me know if there is anyother workaround

regards,
rajarp
# 2  
Old 01-17-2008
Maybe something like this....

cd ../..
find `pwd`/MIS/LANDING -name MIS_Customer_\*
cd -

That "cd -" returns you to your last directory is most modern shells.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Relative Pathnames

Hi, Could anyone help me with the following questions about relative addressing. The questions are: 1) Enter below the command to copy the file basics.pptto the folder outline, using relative addressing. 2) Enter below to move the file .secrets.doc to the folder Day1 using relative addressing.... (1 Reply)
Discussion started by: ml123
1 Replies

2. UNIX for Dummies Questions & Answers

Relative column offsets

Ive been trying to slide the second column one line down while keeping the first one in place. For a start, I tried to see if I can go through every line and print the element located on the line below with the following command, but it didnt work. Maybe awk is not the right way to do it. Matlab... (6 Replies)
Discussion started by: Alabama
6 Replies

3. Shell Programming and Scripting

Relative path not safe

Hallo everyone, I am running an SQL-Script over KShell-Script. Thus, in the KShell-Script there are these lines: WORKPATH=$PWD/work EXPORTDIR=export_meine_datei_bitte EXPORTPATH=${WORKPATH}/${EXPORTDIR} ... db2 connect to ${DBNAME} || die "can not open database connection" db2... (9 Replies)
Discussion started by: ratnalein88
9 Replies

4. Solaris

Solaris clustering IP Multi Pathing

Hi All, Can any one please tell me how IPMP has been configured in a 2 node cluster. Thanks in advance vks (1 Reply)
Discussion started by: vks47
1 Replies

5. Shell Programming and Scripting

tar and relative paths

HOw can I create a tar file with relative paths find . -depth -print | xargs tar -cvf /tmp/file.tar ? Thanks to all who answer (1 Reply)
Discussion started by: BeefStu
1 Replies

6. UNIX for Dummies Questions & Answers

Absolute and Relative Paths?

Can someone cofirm that I have got the paths correct here? :confused: $PATH_TO_TMP_DIR='/tmp'; #$PATH_TO_TMP_DIR='home/tmp'; $PATH_TO_YOUR_IMG_DIR = '/temp_images'; #$PATH_TO_YOUR_IMG_DIR = 'home/public_html/Midwich/temp_images'; Thanks (1 Reply)
Discussion started by: stubie
1 Replies

7. Shell Programming and Scripting

how to read the relative path

suppose i ahve a shell script Nsdnet.sh inside a directory /dialp/Release/bin another file nsdnet_file.csv is under the same directory. Now in the shell script i have call a java file, which reads the csvfile from the commandline. Now when i run the file as $ ./Nsdnet.sh ./nsdnet_file.csv then... (5 Replies)
Discussion started by: priyanka3006
5 Replies

8. UNIX for Dummies Questions & Answers

get cygpath to leave relative paths as relative?

If I execute mypath=`cygpath -w ../` echo $mypath I get d:\unix\nextVersion\script OK, d:\unix\nextVersion\script is the correct windows version of the path, but it is in absolute form. I would prefer it if cygpath left it in relative form, i.e. echo $mypath should output ..\ ... (0 Replies)
Discussion started by: fabulous2
0 Replies

9. UNIX for Dummies Questions & Answers

list all ports and their relative IP@ if any

Hi all i'm working on a LINUX-based platform. i'm little confused with PORTs. i have my platform connected to many other platforms, i need to know the relative port for each IP@. i know the IP of each connected platform to mine, but i'm not sure about the relative PORT for each platform...... (4 Replies)
Discussion started by: samsal_991
4 Replies

10. Programming

relative pointers on Unix

Hi all: We're porting lot of C code from Windows to Unix. In Windows we're using relative pointers (with the _based keyword) to access some structures placed on shared memory. We would need something like the Microsoft's _based keyword for unix. Does something similar exist in Unix? If not, is... (3 Replies)
Discussion started by: rahul_verma
3 Replies
Login or Register to Ask a Question