Sponsored Content
Top Forums Shell Programming and Scripting Loading ".cfg" file from different directory Post 302547084 by Sekullos on Saturday 13th of August 2011 07:16:38 PM
Old 08-13-2011
Ah yes! working perfectly.

Better solution than declaring some new path in your .profile :

Code:
#!/bin/sh

export CFG_DIR=/path/do/your/cfg/dir
source $CFG_DIR/function.cfg

Functions loaded. All good.

Thanks mate!

Last edited by Sekullos; 08-13-2011 at 09:13 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

Delete files older than "x" if directory size is greater than "y"

I wrote a script to delete files which are older than "x" days, if the size of the directory is greater than "y" #!/bin/bash du -hs $1 while read SIZE ENTRY do if ; then find $1 -mtime +$2 -exec rm -f {} \; echo "Files older than $2 days deleted" else echo "free Space available"... (4 Replies)
Discussion started by: JamesCarter
4 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Shell Programming and Scripting

"find . -printf" without prepended "." path? Getting path to current working directory?

If I enter (simplified): find . -printf "%p\n" then all files in the output are prepended by a "." like ./local/share/test23.log How can achieve that a.) the leading "./" is omitted and/or b.) the full path to the current directory is inserted (enclosed by brackets and a blank)... (1 Reply)
Discussion started by: pstein
1 Replies

5. UNIX for Dummies Questions & Answers

look for file size greater than "0" of specific pattern and move those to another directory

Hi , i have some files of specific pattern ...i need to look for files which are having size greater than zero and move those files to another directory.. Ex... abc_0702, abc_0709, abc_782 abc_1234 ...etc need to find out which is having the size >0 and move those to target directory..... (7 Replies)
Discussion started by: dssyadav
7 Replies

6. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

7. UNIX for Dummies Questions & Answers

When loading Linux "loading please wait.." then nothing?

Hi everyone, I have a problem but I have never installed a separate OS before so my lingo and understanding may not be as good as some of you. I will try and explain my problem best I can. I am trying to instead of loading Windows 7 when my computer starts up, for it to start linux specifically... (2 Replies)
Discussion started by: markhow30
2 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

9. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
File::SearchPath(3pm)					User Contributed Perl Documentation				     File::SearchPath(3pm)

NAME
File::SearchPath - Search for a file in an environment variable path SYNOPSIS
use File::SearchPath qw/ searchpath /; $file = searchpath( 'libperl.a', env => 'LD_LIBRARY_PATH' ); $file = searchpath( 'my.cfg', env => 'CFG_DIR', subdir => 'ME' ); $path = searchpath( $file, env => 'PATH', exe => 1 ); $path = searchpath( $file, env => 'PATH', dir => 1 ); $file = searchpath( 'ls', $ENV{PATH} ); $exe = searchpath( 'ls' ); DESCRIPTION
This module provides the ability to search a path-like environment variable for a file (that does not necessarily have to be an executable). FUNCTIONS
The following functions can be exported by this module. searchpath This is the core function. The only mandatory argument is the name of a file to be located. The filename should not be absolute although it can include directory specifications. $path = searchpath( $file ); @matches = searchpath( $file ); If a second argument is provided, it is assumed to be a path like variable. This interface is provided for backwards compatibility with "File::SearchPath" version 0.01. It is not as portable as specifying the name of the environment variable. Note also that no specific attempt will be made to check whether the file is executable when the subroutine is called in this way. $path = searchpath( $file, $ENV{PATH} ); By default, this will search in $PATH for executable files and is equivalent to: $path = searchpath( $file, env => 'PATH', exe => 1 ); Hash-like options can be used to alter the behaviour of the search: env Name of the environment variable to use as a starting point for the search. Should be a path-like environment variable such as $PATH, $LD_LIBRARY_PATH etc. Defaults to $PATH. An error occurs if the environment variable is not set or not defined. If it is defined but contains a blank string, the current directory will be assumed. exe If true, only executable files will be located in the search path. If $PATH is being searched, the default is for this to be true. For all other environment variables the default is false. If "dir" option is specified "exe" will always default to false. dir If true, only directories will be located in the search path. Default is false. "dir" and "exe" are not allowed to be true in the same call. (triggering a croak() on error). subdir If you know that your file is in a subdirectory of the path described by the environment variable, this direcotry can be specified here. Alternatively, the path can be included in the file name itself. In scalar context the first match is returned. In list context all matches are returned in the order corresponding to the directories listed in the environment variable. Returns undef (or empty list) if no match could be found. If an absolute file name is provided, that filename is returned if it exists and is readable, else undef is returned. HISTORY
"File::SearchPath" used to exist on CPAN (now on backpan) and was written by Robert Spier. This version is completely new but retains an interface that is compatible with Robert's version. Thanks to Robert for allowing me to reuse this module name. NOTES
If "Env::Path" module is installed it will be used. This allows for more flexibility than simply assuming colon-separated paths. SEE ALSO
Env::Path, File::Which, File::Find, File::Find::Run, File::Where. AUTHOR
Tim Jenness <t.jenness@jach.hawaii.edu> Copyright (C) 2005,2006, 2008 Particle Physics and Astronomy Research Council. Copyright (C) 2009-2010 Science and Technology Facilities Council. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,Suite 330, Boston, MA 02111-1307, USA perl v5.14.2 2012-03-28 File::SearchPath(3pm)
All times are GMT -4. The time now is 12:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy