Sponsored Content
Operating Systems Linux Ubuntu Modifying PATH (LINUX, Ubuntu) Post 302551561 by Tolmac on Tuesday 30th of August 2011 10:50:29 PM
Old 08-30-2011
Modifying PATH (LINUX, Ubuntu)

Hello,

I'm a newbi to Unix and the last few weeks I have been trying to learn Unix through a book called Unix in 24 hours. I have tried advanced shell programming (that's what the chapter is called) today and what the excersise was all about was to create mylocate - a version of locate that is a shell script. The first step was to write a script that would build a database of every file and directory that is accessible to my login. Once that script was done and changed to executeable I tried it out as he (the author) had suggested and I got outputs similar to the ones in his book. So that step worked. Next was to create a script that used grep to allow easy file searching. (I try to understand as much as I can but not everything is always explained, so I'm still stumbling around in the dark quite a bit...). The second script was called mylocate. Once that was executable I again did some testruns he suggested and they worked (e.g. ./mylocate "\.c$" | wc -l).

The problem started once I did the next step - to make it part of my overall environment...
So like he suggested, I went back to $HOME with cd (my $HOME is /home/ubuntu), created a new bin (mkdir bin) and moved both scripts I had written somewhere else (in my file that is in home/ubuntu/data/user) into the new bin (with mv). When I move to bin and check with ls, both scripts are there (mkmylocatedb and mylocate). Both are still executable. Next step would be to modify PATH so that at the end I only need to type in command names from my new bin (he wanted to link it to .profile). He said to write:
Code:
echo 'export PATH="${PATH}:$HOME/bin"' >> ~/.profile

Once I did that, nothing worked - and any other scripts I wrote afterwards and are linked to bin are not working either. I tried every combination I could and nothing, only command not found. I went to .profile and opened it with the vi editor - deleted the export blablabla out and saved the changes. Now at least ./mylocate works again but nothing else and only when I have moved to bin - anywhere else I get the same error message as before.

.profile says first something about its execution, when and when not it's read, where the default is set (in /etc/profile unmask 022), some info about if running bash (my shell is bash) and then the last if statement is:
Code:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi

So my private bin exists, the command I was supposed to write was $HOME/bin - and as $HOME is /home/ubuntu it should work, shouldn't it? What do I have to type (and more importantly why) to actually link the new bin to .profile (or would I have to link it to /etc/profile???) so I could actually execute it like I can ls or cat or cp or any other command? (wherever I am..)

Sorry for this lengthy thread. I hope I haven't left out any important information - if I did, please let me know.

Thank you so much!

Last edited by pludi; 08-31-2011 at 07:02 AM..
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Modifying $PATH variable in /etc/profile

In my /etc/profile, my $PATH variable is set as follows: $PATH =/sbin:/usr/sbin:/usr/bin:/etc Then how do I add an additional directory to it? say /export/home/abd/rose Please advise. Thanks! Deepali (3 Replies)
Discussion started by: Deepali
3 Replies

2. Ubuntu

XP and Linux (Ubuntu) on same disk, Can I install Ubuntu on not-yet partitioned portion of disk?

My PC (Esprimo, 3 yeas old) has one hard drive having 2 partitions C: (80 GB NTFS, XP) and D: (120 GB NTFS, empty) and and a 200 MB area that yet is not-partitioned. I would like to try Ubuntu and to install Ubuntu on the not-partitioned area . The idea is to have the possibility to run... (7 Replies)
Discussion started by: C.Weidemann
7 Replies

3. Ubuntu

Ubuntu samba server path

Hi, I can see a folder is mounted in my Ubuntu 8.04 machine through samba share. But, I could not find it out its actual location in the disk. If I issue the command sudo smbclient -L user its listing the folder as 'sharename' and 'type' as disk So, anyone help me how can I locate the... (0 Replies)
Discussion started by: royalibrahim
0 Replies

4. Linux

Modifying Linux in WesternDigital net disks

Hi, I am installing perl and rsnapshot on the OS of a Western Digital MyBook disk. To install perl the ./Configure command tells me that both 'tr' and 'split' are missing. I don't find them on the net. Where can I download them? Thanks. Charles. (2 Replies)
Discussion started by: mosndup
2 Replies

5. Programming

Help with C in linux Ubuntu 12.04

I'm trying to use the sytem() to send a terminal command. I haven't been able to run the program. Can someone show me how am I suppose to write this command: (echo "#o1" > /dev/ttyUSB1). Is there a better way to use the command on the C file so that when I call the file and run it on the terminal... (11 Replies)
Discussion started by: Hector M.
11 Replies

6. Ubuntu

Application clustering in Linux Ubuntu

Dear, Please help me to configure application clustering in linux ubuntu. Application is running apache server. Please help Jewel ---------- Post updated at 01:07 PM ---------- Previous update was at 12:48 PM ---------- linuxvirtualserver dot org in this link i go there's three... (2 Replies)
Discussion started by: Jewel100
2 Replies
PBUILDER-DIST-SIMPLE(1) 				      General Commands Manual					   PBUILDER-DIST-SIMPLE(1)

NAME
pbuilder-dist-simple - simple multi-release pbuilder wrapper SYNOPSIS
pbuilder-<dist> operation [...] DESCRIPTION
pbuilder-dist-simple is a wrapper that makes it easy to use pbuilder with chroots for many different Ubuntu distributions. If you need more features than pbuilder-dist-simple provides, have a look at pbuilder-dist(1). USAGE
Create one symlink to pbuilder-dist-simple for each distribution for which you want a build environment, naming them like "pbuilder-lucid", "pbuilder-natty", etc. Replace operation with the action you want pbuilder-dist-simple to do (create, update, build, clean, login or execute). EXAMPLES
pbuilder-natty create Creates a pbuilder environment for Ubuntu Natty. pbuilder-lucid update Updates an existing Ubuntu Lucid environment. pbuilder-lucid build ./sample_1.0-0ubuntu1.dsc Builds the specified package on an already existing Ubuntu Lucid environment. FILES
By default, pbuilder-dist-simple will store all the files it generates in ~/pbuilder/. This can be changed by modifying the BASE_DIR value on the top of the script to any other directory you want. If the directory doesn't exit, it will be created at runtime. SEE ALSO
pbuilder(1), pbuilderrc(5), pbuilder-dist(1) AUTHORS
pbuilder-dist was originally written by Jamin W. Collins <jcollins@asgardsrealm.net> and Jordan Mantha <mantha@ubuntu.com>, and this man- page by Siegfried-A. Gevatter <rainct@ubuntu.com>. Both are released under the GNU General Public License, version 2 or later. ubuntu-dev-tools February 25, 2008 PBUILDER-DIST-SIMPLE(1)
All times are GMT -4. The time now is 07:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy