LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 12-10-2003, 08:42 AM   #1
f0rmula
Member
 
Registered: Dec 2003
Posts: 72

Rep: Reputation: 15
.bashrc


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??

cheers..

james
 
Old 12-10-2003, 08:45 AM   #2
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
Put in .bashrc

export PATH=$PATH:/j2sdk_nb/j2sdk/bin/java

Then do this to update your path:
. ~/.bashrc

Last edited by /bin/bash; 12-10-2003 at 08:46 AM.
 
Old 12-10-2003, 08:48 AM   #3
f0rmula
Member
 
Registered: Dec 2003
Posts: 72

Original Poster
Rep: Reputation: 15
ahh.. cheers..

so that adds it to whatever is in path already..

just curious, but when i type "set" to see what vars are set, i get huge long shell script thing?!?! is this normal too??

james
 
Old 12-10-2003, 10:13 AM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by /bin/bash
Then do this to update your path:
. ~/.bashrc
If your already in your home directory and your .bashrc file is executable, you can just simply do a ./.bashrc or a source .bashrc
 
Old 12-10-2003, 10:25 AM   #5
f0rmula
Member
 
Registered: Dec 2003
Posts: 72

Original Poster
Rep: Reputation: 15
ok.. its all sorted now..

just seemed to be a bit odd, having a shell script in an environment variable..

james
 
Old 12-10-2003, 10:26 AM   #6
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
Quote:
Originally posted by f0rmula
just curious, but when i type "set" to see what vars are set, i get huge long shell script thing?!?! is this normal too??
If you mean something along the lines of...
Code:
BASH=/bin/bash
BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="1" [4]="release" [5]="i386-pc-linux-gnu")
BASH_VERSION='2.05b.0(1)-release'
COLORFGBG='default;0'
COLORTERM=rxvt-xpm
COLUMNS=80
DIRSTACK=()
DISPLAY=:0.0
EUID=1000
GDK_USE_XFT=1
GDMSESSION=xfce
GROUPS=()
HISTFILE=/home/hw/.bash_history
....etc
...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 .

Håkan
 
Old 12-10-2003, 10:27 AM   #7
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
Oh, and if set doesn't do it for you, just try typing env instead.

Håkan
 
Old 12-10-2003, 01:59 PM   #8
95se
Member
 
Registered: Apr 2002
Location: Windsor, ON, CA
Distribution: Ubuntu
Posts: 740

Rep: Reputation: 32
why not put it in /etc/profile?? That way it is in all users path. (you can also add a source /etc/profile to your .bashrc)
 
Old 12-11-2003, 04:14 AM   #9
f0rmula
Member
 
Registered: Dec 2003
Posts: 72

Original Poster
Rep: Reputation: 15
oh.. i didnt know about /etc/profile

i put it in /etc/bashrc.. will it do the same thing?

james
 
Old 12-11-2003, 08:17 AM   #10
95se
Member
 
Registered: Apr 2002
Location: Windsor, ON, CA
Distribution: Ubuntu
Posts: 740

Rep: Reputation: 32
I don't have a /etc/bashrc (in slackware, i have a ~/.bashrc however). Bourne shells use /etc/profile usually.
 
Old 12-11-2003, 09:12 AM   #11
f0rmula
Member
 
Registered: Dec 2003
Posts: 72

Original Poster
Rep: Reputation: 15
well... seems to work fine

cheers

james
 
Old 12-11-2003, 10:44 AM   #12
hopmedic
Member
 
Registered: Sep 2003
Location: in a small town west of Chicago
Distribution: Fedora
Posts: 30

Rep: Reputation: 15
Question Pathing commands

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?

Thanks,

Rich
 
Old 12-11-2003, 06:06 PM   #13
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
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.




Håkan
 
Old 12-11-2003, 07:50 PM   #14
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
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.
 
Old 12-11-2003, 08:56 PM   #15
hopmedic
Member
 
Registered: Sep 2003
Location: in a small town west of Chicago
Distribution: Fedora
Posts: 30

Rep: Reputation: 15
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...

Thanks,

Rich
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
where is bashrc ? Kanaflloric Slackware 12 10-06-2007 02:47 PM
.bashrc ? Longinus Linux - Newbie 2 03-27-2004 11:50 AM
no .bashrc? mattman Slackware 6 06-10-2003 03:59 PM
bashrc nobu Slackware 6 03-21-2003 10:53 AM
.bashrc prasad Linux - General 1 04-14-2001 09:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration