LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   how to make a file that will open specific things for you (http://www.linuxquestions.org/questions/programming-9/how-to-make-a-file-that-will-open-specific-things-for-you-251732/)

zexter 11-06-2004 04:04 AM

how to make a file that will open specific things for you
 
how would i go about making a file that would open up a certain directory instead of me typing cd "directory" everytime i want to use that program?


-thanks in advance

n0xvb 11-06-2004 04:10 AM

You can create a script file that would do that for you.. Let's call this file

gothere


#!/bin/sh
#
#
cd /go/to/this/directory
#


That's it! Put whatever directory in that you want after the cd.
After you create this file, do this command:

chmod +x gothere

And if you want it to be available no matter what directory you are currently in, do something like this:

cp gothere /usr/bin/gothere

Cedrik 11-06-2004 08:04 AM

Or you could use your shell alias function, like in Bash :
alias myprogram="cd /path/to/your/directory; ./myprogram"

then you just type :
myprogram
to access the directory and execute 'myprogram' from here


All times are GMT -5. The time now is 10:11 PM.