Sponsored Content
Full Discussion: Creating a PATH variable
Top Forums Shell Programming and Scripting Creating a PATH variable Post 303027887 by Circuits on Thursday 27th of December 2018 11:29:15 AM
Old 12-27-2018
Just want to make sure I understand completely. Specifying the PATH variable means that the program will automatically assume a path for functions like cp or what-have-you without actually referencing the variable: PATH? This would make sense because the deceleration of PATH is the only place in the script where it is being referenced by name. Then again, the only place data_dir is being referenced by name is in the instantiation as well. Is it possible that data_dir is acting in a similar way to PATH or is it more likely that data_dir was just never used after it was declared?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Creating alias for directory path

I am trying to create an alias for a frequently used directory path by using alias xyz="/proj/dir_name" and then trying to reach a sub-directoy by using cd xyz/abc but I get an error saying " No such file or directory " plz tell me wats wrong with this ... (3 Replies)
Discussion started by: jasjot31
3 Replies

2. UNIX for Dummies Questions & Answers

creating a variable

I cannot seem to get the following script to work. I cannot seem to set the variable. What am I missing? bin/bash set -x echo "2" > /tmp/number STATUS='grep -c 2 /temp/number' if ; then echo "Number 2 is found once" else echo "Number 2 is found more or less than one time" fi (3 Replies)
Discussion started by: rexmabry
3 Replies

3. Shell Programming and Scripting

Getting the path from a variable

Hi, I am having a variable Like line="/dir1/dir2/gr3/file.ksh" I need to get the /dir1/dir2/gr3 alone. the no of directories may differ at each time. Please advice. thanks in advance. (3 Replies)
Discussion started by: vanathi
3 Replies

4. Shell Programming and Scripting

Sed variable substitution when variable constructed of a directory path

Hello, i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem. my var1 is a string constructed like this: filename1 filerev1 filepath1 my var2 is another string constructed like this: filename2 filerev2 filepath2 when i do... (2 Replies)
Discussion started by: alrinno
2 Replies

5. Shell Programming and Scripting

remove a path from PATH environment variable

Hi I need a script which will remove a path from PATH environment variable. For example $echo PATH /usr/local/bin:/usr/bin:test/rmve:/usr/games $echo rmv test/rmve Here I need a shell script which will remove rmv path (test/rmve) from PATH... (9 Replies)
Discussion started by: madhu84
9 Replies

6. Shell Programming and Scripting

one liner to extract path from PATH variable

Hi, Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable? for eg: suppose the PATH is being set as follows PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4 ... (2 Replies)
Discussion started by: royalibrahim
2 Replies

7. Shell Programming and Scripting

Appending a path in user's PATH variable

Hello Folks, I want to append a path in user's PATH variable which should be available in current session. Background Numerous persons will run a utility. Aim is to add the absolute path of the utility the first time it runs so that next runs have the PATH in env & users can directly run... (6 Replies)
Discussion started by: vibhor_agarwali
6 Replies

8. Shell Programming and Scripting

Path a variable to sed that includes a path

Hi I'm trying to select text between two lines, I'm using sed to to this, but I need to pass variables to it. For example start="BEGIN /home/mavkoup/data" end="END" sed -n -e '/${start}/,/${end}/g' doesn't work. I've tried double quotes as well. I think there's a problem with the / in the... (4 Replies)
Discussion started by: mavkoup
4 Replies

9. Shell Programming and Scripting

File creating in another path.. application unable to locate

I am submitting a concurrent program (of HOST tyme) from Oracle apps screen, The MAIN shell program submits another program, (child) which is also a Shell program. The child writes data to log file. Now the main program, read the log and do some calculations and sends the data to user through... (1 Reply)
Discussion started by: Pradeep Garine
1 Replies

10. Shell Programming and Scripting

Readin document & creating path

Need a way to read a file in who every line is a path to a directory and make shortcut to that directory on a specific place. Example: line in the document /media/gogo/6651-FEAB/Desktop/ /media/gogo/6651-FEAB/Desktop/alex/ /media/gogo/6651-FEAB/linux/ ... (3 Replies)
Discussion started by: gogok_bg
3 Replies
ENVPATH(1p)						User Contributed Perl Documentation					       ENVPATH(1p)

NAME
envpath - Advanced operations on path variables SYNOPSIS
Run this script with the "-help" option for usage details. DESCRIPTION
Parses the command line, modifies the specified path variable(s), and execs the remaining arguments. There are two modes, simple and advanced: SIMPLE MODE Simple mode presents an alternative, platform-independent syntax for specifying paths wherein the path separator is "," and environment variables can be expanded with @NAME@. For example envpath PATH=@PATH@,/usr/ucb -- printenv PATH appends "/usr/ucb" to $PATH and execs printenv PATH. The "--" is optional. You can also specify prepending or appending by using "+=" or "=+" respectively: # place /usr/ucb at the front envpath PATH+=/usr/ucb -- printenv PATH # place /usr/ucb at the back envpath PATH=+/usr/ucb -- printenv PATH Simple mode requires only this script; it does not require Env::Path to be installed. ADVANCED MODE Advanced mode basically provides command-line access to the features of Env::Path (see), which must be installed. The "-E" flag selects the path variable to operate on and other flags specify operations on it. E.g. envpath -E MANPATH -A /tmp -R /usr/share/man -N -U -- man ... would take MANPATH, append /tmp to it, remove any references to "/usr/share/man", remove any dirs which don't exist ("-N") and remove redundant entries ("-U") before running man. The -Whence option allows patterns. Thus envpath -W "cat*" would find all programs on PATH which match cat*. CLEARCASE WINKINS
A big part of the motivation for this script was for use with ClearCase builds; iff you know or care about ClearCase read on. Typically, during builds (and not just with ClearCase), pathvars such as PATH, CLASSPATH, and LD_LIBRARY_PATH must be strictly controlled. One choice is to force static values of these into the environment during the build process, another is to simply require/expect users to set their paths appropriately. Each of these can lead to subtle build or runtime errors, however, and makes it hard for new users to get up to speed since their personal environment must be just so. Another common choice is to use only full pathnames within the Makefile, avoiding reliance on search paths at all. This is often the best way to go but can suppress ClearCase winkins. For example, say you're generating ascii files of some type with a binary executable you just built: $(INCDIR)/foo.h: $(BINDIR)/foomaker $(BINDIR)/foomaker ... The problem with this is that $(BINDIR) likely contains a platform part such as 'solaris' or 'hpux', which makes it impossible to wink in the foo.h file on other platforms even though it's ascii. This same thing could come up even with a standard pre-built utility that's in different places on different platforms; "yacc", for instance, is in /usr/bin on Linux and /usr/ccs/bin on Solaris. You could modify the path on the fly: $(INCDIR)/foo.h: $(BINDIR)/foomaker PATH=$(BINDIR)$(SEP)$$PATH foomaker ... but this suffers from the same problem: since $(BINDIR) and $PATH are expanded literally within the build script they'll suppress winkins. Here's a solution using envpath: $(INCDIR)/foo.h: $(BINDIR)/foomaker envpath PATH=@BINDIR@,@PATH@ foomaker ... This hides the evaluation of BINDIR and PATH such that clearmake never sees anything but the literals, thus clearing the field for winkins. Of course envpath is capable of doing more than this, but it's the original reason it was written. AUTHOR
David Boyce <dsbperl AT boyski.com> COPYRIGHT
Copyright (c) 2000-2001 David Boyce. All rights reserved. This Perl program is free software; you may redistribute and/or modify it under the same terms as Perl itself. SEE ALSO
perl(1), "perldoc Env::Path" perl v5.10.1 2003-10-10 ENVPATH(1p)
All times are GMT -4. The time now is 06:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy