Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 09-23-2002, 03:18 PM   #1 (permalink)
julesh
Registered User
 
Join Date: Sep 2002
Location: alexandria
Posts: 2
julesh is on a distinguished road
bash programming

from julesh:
can anyone show me how to add a directory to a search path?or does anyone knows where i could go to look for information to create executeble files .in order for me to excecute a file it has to be added to the search path.anyone who can show me how or direct me to a place where i can that information would be greatly appreciated.
Thank you in advance.
julesh is offline   Reply With Quote
Old 09-23-2002, 05:03 PM   #2 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
Say for example you have a directory named ~/bin that you want to keep all your personal apps and scripts in. You can change your PATH setting at the shell simply with the command

prompt$ PATH="$PATH:$HOME/bin"

That will take the current $PATH value and add your ~/bin directory to it. If you want to make this permanent, edit your ~/.bash_profile and put in the line
Code:
export PATH="$PATH:$HOME/bin"
Either logout and back in again or 'source' the .bash_profile file to read in the new configuration. It will be automatically set from then on when you login.

To make a file executable, simply change it's permissions like so:

prompt$ chmod +x filename.sh

Use the command 'man chmod' for more information on changing permissions.
bdl is offline   Reply With Quote
Old 09-24-2002, 11:45 AM   #3 (permalink)
julesh
Registered User
 
Join Date: Sep 2002
Location: alexandria
Posts: 2
julesh is on a distinguished road
bash programming/thanks bdl

bdl ,i have tried doing what you showed me.
i have been half way succesful at it.

but if i may explain what i'm trying to do.
i'm learning from a book name Redhat linux 7.2 unleashed.
on page 595 of that book is there a sample program.
#! /bin/sh
alias ll='ls -l'
alias dir='ls'
alias copy='cp

i saved this file as myenv.
and then i enter the command # chmod +x myenv.

after that i enter the command
export PATH="$PATH:$HOME/bin"

after all this i enter, as instructed in the book, myenv as a command .
i got an error message stating that command not found.

Can you explain to me what i'm doing wrong or missing?

your help is greatly appreciated.
julesh is offline   Reply With Quote
Old 09-24-2002, 08:30 PM   #4 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
Well, the type of file you describe is more the type of thing you'd put in your ~/.bashrc file, or the file that holds some configuration that you want available at each login. In order to make those aliases available, you wouldn't need to execute the script, just 'source' the script on boot. So what I'd do is create a file called ~/.bashrc and put the same alias lines in, and the next time you login those aliases will be available for use.

Other than that, I'd guess that the reason you weren't able to use the file is because you didn't actually save it to ~/bin/myenv. If you added ~/bin to your PATH, the directory must exist, and all scripts and binaries you want to use must be within that directory.
bdl is offline   Reply With Quote
Old 09-29-2002, 06:02 AM   #5 (permalink)
kenshi
Registered User
 
kenshi's Avatar
 
Join Date: Jun 2002
Location: Antarctica
Posts: 43
kenshi is on a distinguished road
Send a message via ICQ to kenshi
Unix, unlike Dos, doesn't automatically search the current directory for executables. You can change your path so that it does, but it's not recommended. Instead, either type the full path to the executable or if you're in the same directory as it, type ./command.
kenshi is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparison of Different Programming Languages Punch-M6.net All Other Coding Languages 23 04-19-2007 01:34 PM
Does anyone know programming and coding?? dsantamassino Lounge 5 10-31-2004 02:16 PM
which programming languages do you know? ashish Lounge 11 10-27-2004 02:02 PM
Implementing Run Length Encoding on Bitmaps in C Programming kodonovan_cork Standard C, C++ 0 04-21-2004 10:23 AM
CLI for noobies: shell programming sde Code Newbie News 0 03-15-2004 12:33 PM


All times are GMT -8. The time now is 01:50 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting