The reason I can't do cd ~ is because it may or may not be in the home directory. Here is why. The way I intend to distribute this program is by zipping up the directory tree which looks like
/Parse/Linux/<Linux executable> /Parse/Windows/<Windows executable> /Parse/123.dat Now the user could save this anywhere they want. Now in Win I can tell people to create a shortcut to /<some directory>/Parse/Windows/<Windows executable> & place it in any folder they want. The 123.dat file is read relative to the executables. How do I do the same in Linux? Hope I explained it better this time... -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom_Gordon/RISE/[EMAIL PROTECTED] Sent: Tuesday, May 18, 2004 1:54 PM To: Linux/Unix Advocates/Users Hawaiian community discussion list Subject: RE: [LUAU] Windows shortcut equivalent in Linux you could cd ~ as long as the script cds back to your previous directory, correct? like foo=`pwd`;cd ~;echo 'hello from '`pwd`'!';cd $foo i'm still a bit confused but here i go: 1) put your executable in a directory in PATH so you can run it from location 2) reffer to your settings file relative to home ~/Parse/Linux/file but i see your data file is the same as your user name so maybe ~/Parse/Linux/file`whoami` is what your after. i also see that you want to run executibles and read data from one user to other users on the system. perhps your script is better off in /usr/local/bin and your data file in /etc (if it doesn't change, then again, why would it even exist if it didn't?) =\ "Vikram Khurana" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 18/05/2004 12:30 PM Please respond to Linux/Unix Advocates/Users Hawaiian community discussion list To: <[EMAIL PROTECTED]> cc: Subject: RE: [LUAU] Windows shortcut equivalent in Linux Sorry I didn't explain my question well enough. I can't do a cd ~ in the script, because I don't want to change the directory I'm in I have a file called Parse.ui in the /home/xyz/Parse/Linux directory Parse.ui is a Perl Tk application which runs by doing ./Parse.ui in the Linux directory. When I run Parse.ui, it reads a parameter file called xyz.dat in the /home/xyz/Parse directory(I can move this to the /home/xyz/Parse/Linux directory if needed) . Now I want to run this application from different directories say /home/data/trial1/abc Anyway to do this? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of MonMotha Sent: Tuesday, May 18, 2004 10:50 AM To: Linux/Unix Advocates/Users Hawaiian community discussion list Subject: Re: [LUAU] Windows shortcut equivalent in Linux Vikram Khurana wrote: > Hi, > > I want to run a program that resides in a particular directory, say > /home/Parse > When the program is run it reads some files in the /home directory using a > relative path ../<file name> > > I want to run this program from other directories without having to copy the > program & required files to those directories. > > I have tried using symlink, but that does not read the files in /home > I can't seem to figure out how to do this using an alias either. > > In windows I create a shortcut & that runs from anywhere I place the > shortcut. I essentially need the same functionality in Linux. > > Can someone please tell me the best way to solve this. > > Thanks, > Vikram > That's not a bug, that's a feature :) Seriously, that's a feature. In Unix, every application has it's own working directory which is whereever it is started from, unless the app changes that. All relative paths are derrived from that working directory. Normally this is a good thing, but in your case, I guess it's not. From the sound of it, this "Parse" is a shell script. The quick fix is to place a "cd ~" at the top to make it's current working directory your home directory (be aware that if other people run it, it will use THEIR home directory, not yours). The proper way is to use absolute paths any time you want to reference a file absolutely. Windows actually has this convention as well, though I think there may be an option in the "shortcut" properties to set the working directory for these (broken) applications. --MonMotha _______________________________________________ [email protected] mailing list http://lists.hosef.org/cgi-bin/mailman/listinfo/luau _______________________________________________ [email protected] mailing list http://lists.hosef.org/cgi-bin/mailman/listinfo/luau _______________________________________________ [email protected] mailing list http://lists.hosef.org/cgi-bin/mailman/listinfo/luau
