Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Mandrake 9.2, i've been to the sun site and installed my lovely new jdk and java ide thing..
it currently resides in its own little directory off root (/j2sdk_nb) and doesnt install itsself across the system like most things do..
i take it its supposed to do this.. why would this be?
also whilst i can use the commands directly (/j2sdk_nb/j2sdk/bin/java) they arn't "path'd".. i've dont think before by changing my .bashrc, but in 9.2 neither /etc/bashrc or ~/.bashrc have anything about setting the path environment variable..
how on earth do i go about adding these paths in so i can access these commands from anywhere??
...yes, this is normal. It is not a shell script but the current environment variables. You can check individual environment variables by typing echo VARIABLE_NAME, like this: echo $PATH .
I believe I'm trying to do something similar, but being a noob, I'm not sure I understand all of this, or perhaps my situation is different because I am using Redhat. I'm working on a project for my Unix class, and here's what I'm wanting to do...
I need to create a command that will work like the Recycle Bin on MS. I know RH9 has this, but this is for a unix class, and has to be in shell. I am thinking that I will create a script that will accept an argument on the command line, that arg being the file that you want to move to the "recycle bin" which will be a hidden folder, i.e. "/.garbage". I will append the current path of the file to that file, cp it to the new directory, verify that the cp worked, then rm the original. If the user wants to restore the file, I will have another shell script to find the appended info, cut that info out of the file, cp the file to the original path, verify the cp, then remove the file from the /.garbage folder.
Anyway, I want to be able to use this command from any directory - not have to go to the directory where the script is stored to execute it. How do I path the filename so that I can execute it from a command line at any directory? Does it sound like I'm biting off more than I can chew as a noob?
hopmedic, according to the rules of this board we're not supposed to do others' homework, but here are two little tips:
1. To have a personal bin directory and include it in your executable path (so you can execute any program there by just typing the name of the program or script), use this in your .bashrc or .bash_profile:
Code:
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi
2. Look into the alias command, and alias rm to be your script.
What if the file is a binary? How are you going to append the original path to it and retrieve it? Seems like alot of work. Maybe it would be easier to have like a .delete_history file where you can store that info.
OK - sorry for misunderstanding... I'm not asking anyone to do my homework - I'm doing this project for a Unix class, and I just have to upload the script to the instructor - he'll know how to execute it. I want to know how to make it work on my system, too. After all, learning the Linux is part of the reason I'm taking the Unix class.
/bin/bash - hadn't even thought about binaries. Like I said, I'm a noob... and so far all we've worked with in class are scripts and other text files. I figured that would be easy to append to, but you make a good point. I think I like the .delete_history idea - sounds much easier than what I was thinking of.
hw-tph - please allow me to see if I understand your code... First, I'm not sure what the ~ is for in the path, but other than that, I see this: If the ~/bin directory exists, then I'm adding ~/bin to the PATH variable, right? Then I put my script into that ~/bin directory, and viola! I can execute from everywhere. Do I have that right?
I wouldn't expect anyone to do my homework for me, but is it all right to bounce ideas and ask for tips here? After all, it's an online class, and we're allowed to do that on the class site...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.