Sponsored Content
Homework and Emergencies Homework & Coursework Questions Problem with path and child shells Post 302537689 by majickmann on Saturday 9th of July 2011 10:39:50 AM
Old 07-09-2011
The following should be acceptable answers:

a. This will add mytools for the current shell. At command prompt, type the following and hit "enter": PATH=$HOME/mytools:$PATH

b. This will add mytools for child shells as well. At command prompt, type the following and hit "enter": export PATH=$HOME/mytools:$PATH

c. To make this permanent, so commands in mytools directory are usable upon login to the UNIX shell (bash), just add "export PATH=$HOME/mytools:$PATH" to your .bashrc file. Most .bashrc files already have this statement, so it would just be a matter of modifying it.


The placement within PATH is significant. The shell searches for commands from left to right as you read the directories in PATH. In my example, I've placed mytools before all other directories so it is searched first. I do this for two reasons:
1. I want commands in mytools to be used before a command with the same name that is in another directory. Generally, this is not a problem as I don't intentionally use an existing command name.
2. Even if I don't have duplicate command names, I want my scripts to be found quickly. By listing mytools at the beginning, it is searched first. This may only be saving microseconds or less, but that's the way I want it.

Otherwise, adding mytools at the end of the PATH statement is certainly acceptable.

Hope this helps...
--majickmann
 

10 More Discussions You Might Find Interesting

1. IP Networking

child process problem

please do answer it is urgent can any body tell me how can i find whether the child process has been killed or not in a program (1 Reply)
Discussion started by: ramneek
1 Replies

2. UNIX for Dummies Questions & Answers

cc path problem - no acceptable path found

Hello everyone, I'm a unix noob. I have a powerbook running mac os x 10.4 and for one of my classes I need to install the latest version of php (5.0.5). I'm following the instructions at http://developer.apple.com/internet/opensource/php.html to install but I've run into a problem. The... (2 Replies)
Discussion started by: kendokendokendo
2 Replies

3. Shell Programming and Scripting

path problem

hi , i have written csh script i am unable to set PATH variable in my script. my script is like this ===================================== # ! /bin/csh -f setenv PATH "$PATH:/opt/terascan/bin" ls -l > list lspass > pas peekauto > schedule \ num_days = 1 \ exit 0... (1 Reply)
Discussion started by: rajan_ka1
1 Replies

4. UNIX for Advanced & Expert Users

path problem

Hi i am writing a script containing processing commands which are reside in /opt/terascan/bin dir. if i run the script from command prompt it is working fine. but in crontab it is not working. if i give env command from command prompt it is showing /opt/terascan/bin dir in PATH variable. ... (10 Replies)
Discussion started by: rajan_ka1
10 Replies

5. UNIX for Advanced & Expert Users

how to make a parent wait on a child shells running in background?

Hi I have a shell script A which calls another 10 shell scripts which run in background. How do i make the parent script wait for the child scripts complete, or in other words, i must be able to do a grep of parent script to find out if the child scripts are still running. My Code: ... (1 Reply)
Discussion started by: albertashish
1 Replies

6. UNIX for Dummies Questions & Answers

PATH Setting for all shells of a user

How can I modify the path variable of a particular user in all shells? I searched in this forum and as per the advice in some threads created a new file .profile in $HOME directory with the new PATH, but it did not work. (5 Replies)
Discussion started by: JoyceBabu
5 Replies

7. Homework & Coursework Questions

Need help with deleting childīs parent and child subprocess

1. The problem statement, all variables and given/known data: I need to make an program that in a loop creates one parent and five children with fork(). The problem i'm trying to solve is how to delete the parent and child of the childīs process. 2. Relevant commands, code, scripts,... (0 Replies)
Discussion started by: WhiteFace
0 Replies

8. Shell Programming and Scripting

Moving files from parent path to multiple child path using bash in efficient way

Hi All, Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created. /Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt /Path/AdminUser/User1/2222/Reports/bbb.txt to... (6 Replies)
Discussion started by: karthikgv417
6 Replies

9. Shell Programming and Scripting

Problem with PATH

Recently I lost a number of changes I made to a program when the SCO Unix system went down. The system "mail" suggested a "vi -r" option that took me back several days. To prevent this in the future, I am trying to create my own vi command: if then cp -p $1 $1.bak fi /usr/bin/vi $* if ... (5 Replies)
Discussion started by: wbport
5 Replies

10. UNIX for Beginners Questions & Answers

PATH problem

For the sake of not going insane and not buggering a load of needed system stuff, I have created a dir /mybin. (This is a Debian system.) I have then edited the /etc/profile and /etc/login.defs files and added :/mybin to all of the path variables. I have the file /mybin/mtp for... (2 Replies)
Discussion started by: MuntyScrunt
2 Replies
MicroMason::TemplatePath(3pm)				User Contributed Perl Documentation			     MicroMason::TemplatePath(3pm)

NAME
Text::MicroMason::TemplatePath - Template Path Searching SYNOPSIS
Instead of using this class directly, pass its name to be mixed in: use Text::MicroMason; my $mason = Text::MicroMason->new( -TemplatePath, template_path => [ '/foo', '/bar' ] ); Use the standard compile and execute methods to parse and evalute templates: print $mason->compile( file=>$filepath )->( 'name'=>'Dave' ); print $mason->execute( file=>$filepath, 'name'=>'Dave' ); Templates stored in files are searched for in the specified template_path: print $mason->execute( file=>"includes/greeting.msn", 'name'=>'Charles'); When including other files into a template you can use relative paths: <& ../includes/greeting.msn, name => 'Alice' &> When a file is included in the template, the including template's current directory is added to the beginning of the template search path. DESCRIPTION
This module works similarly to the related TemplateDir mix-in. However, instead of specifying a single root which must contain all templates, TemplatePath allows you to specify an arrayref of directories which will be searched in order whenever a template filename must be resolved. Using a TemplatePath object, absolute filenames are used as-is. If a relative template filenames or file paths is used, every directory in the specified template_path is checked for the existence of the template, and the first existing template file is used. If a template includes another template using <& ... &>, then the including template's location is added to the beginning of the template search path list, for the resolution of the included template's filename. This allows the included template to be specified relative to the including template, but also lets the template search fall back to the configured template search path if necessary. Supported Attributes template_path An array ref containing a list of directories in which to search for relative template filenames. strict_root Optional directory beyond which not to read files. Unlike TemplateDir, this must be a specific file path. Causes read_file to croak if any filename outside of the root is provided. You should make sure that all paths specified in template_path are inside the specified strict_root. (Note that this is not a chroot jail and only affects attempts to load a file as a template; for greater security see the chroot() builtin and Text::MicroMason::Safe.) Private Methods read_file Intercepts file access to check for strict_root. EXCEPTIONS The following additional exceptions are generated by Text::MicroMason::TemplatePath when appropriate: o Text::MicroMason::TemplatePath: template '%s' not found in path. This indicates that the specified template name does not exist in any of the directories in the configured path. o Text::MicroMason::TemplatePath: Template not in required base path '%s' The template found in the configured template path was not within the configured strict_root directory. This may be caused by requesting an absolute template filename not within strict_root, or by specifying a strict_root which does not match the configured template path. SEE ALSO
For an overview of this templating framework, see Text::MicroMason. This is a mixin class intended for use with Text::MicroMason::Base. For distribution, installation, support, copyright and license information, see Text::MicroMason::Docs::ReadMe. perl v5.10.1 2009-10-27 MicroMason::TemplatePath(3pm)
All times are GMT -4. The time now is 10:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy