Jump to content

need help with PATH


rizzler

Recommended Posts

hello

 

i have a script called "max.sh" with tars up the files of the user, now when im logged in as "max" i would like this script to be executed everytime i type "tar_files" or someting like that and it should not mather where on the computer i am at the moment. i understood i have to edit /home/max/.bash_profile to be able to achive this, but what to i write here to get this to work?

 

i use latest debian by the way.

Link to comment
Share on other sites

The easiest thing to do would be to rename the file to tar_files and place it within a directory called bin within max's home. This directory is already within your path.

 

If you don't wish to create said directory, you'll need to add whatever directory the script is within to your $PATH variable. This is done by placing the following line within ~/.bashrc

 

PATH="${PATH}:/new/path/to/add"; export PATH

 

Using the above you would still need to rename the file to tar_files.

 

One last method would be to simply create an alias. Again, within ~/.bashrc

 

alias tar_files='/full/path/to/max.sh'

 

After making any changes to ~/.bashrc you need to source it for the changes to take effect.

 

. ~/.bashrc

 

Hope this helps.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.