Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Resolving the UNIX path variable Post 303037368 by rdrtx1 on Tuesday 30th of July 2019 02:18:28 PM
Old 07-30-2019
start with:
Code:
. master_config.sh

PATH="$PATH:$(set | awk -F= 'NR==FNR {vars[$1]=$2; next} vars[$1] && ! ovars[$2]++ {printf $2 ":"}' master_config.sh -)"

 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. UNIX for Advanced & Expert Users

Difference between Unix and Linux for resolving symbols

I came across a difference between Unix and Linux, when it comes to resolving the symbols from the libs. consider the following code segments... $ cat call1.c #include <stdio.h> int a1; extern int a3; void prnt_a3() { printf("\n%d\n",a3); } $ cat test.c #include <stdio.h>... (12 Replies)
Discussion started by: snowline84
12 Replies

8. Shell Programming and Scripting

Resolving the environment variable from a file

Hi, I an having some environment variables exported and the variable name is present in the file. But its not resolving with following commands. Can someone throw some light. db $ grep -v "^#" TD_FWK_NUCLEUS.dbc | grep -v "^$" | xargs -i echo {} wb_bin: ${TD_FWK_NUCLEUS_DBC_WB_BIN_TAG} I... (3 Replies)
Discussion started by: Mohammed Rafi
3 Replies

9. Shell Programming and Scripting

Variable in not resolving in sed

I'm trying to search the 2 pattern in consecutive lines and print them but my variables are not resolving in sed (using bash shell) - # cat testfile2.txt Fixing Storage Locations to remove extra slash; Fixing Storage Locations to remove extra slash; Fixing Storage Locations to remove extra... (2 Replies)
Discussion started by: Mannu2525
2 Replies

10. UNIX for Beginners Questions & Answers

Help for resolving Unexpected EOF while assigning value to variable

#!/bin/sh . /opt/ora/oracle/db/tech_st/11.2.3/PROD_proddb.env sqlplus -s "username/password" << EOF no='sqlplus -s username/password<<EOF set heading off set feedback off Select pt.user_concurrent_program_name report_name , OUTFILE_NAME report_path FROm apps.fnd_concurrent_programs_tl... (12 Replies)
Discussion started by: usman_oracle
12 Replies
MB_CONVERT_VARIABLES(3) 						 1						   MB_CONVERT_VARIABLES(3)

mb_convert_variables - Convert character code in variable(s)

SYNOPSIS
string mb_convert_variables (string $to_encoding, mixed $from_encoding, mixed &$vars, [mixed &$...]) DESCRIPTION
Converts character encoding of variables $vars in encoding $from_encoding to encoding $to_encoding. mb_convert_variables(3) join strings in Array or Object to detect encoding, since encoding detection tends to fail for short strings. Therefore, it is impossible to mix encoding in single array or object. PARAMETERS
o $to_encoding - The encoding that the string is being converted to. o $from_encoding -$from_encoding is specified as an array or comma separated string, it tries to detect encoding from $from-coding. When $from_encoding is omitted, detect_order is used. o $vars -$vars is the reference to the variable being converted. String, Array and Object are accepted. mb_convert_variables(3) assumes all parameters have the same encoding. o $... - Additional $vars. RETURN VALUES
The character encoding before conversion for success, or FALSE for failure. EXAMPLES
Example #1 mb_convert_variables(3) example <?php /* Convert variables $post1, $post2 to internal encoding */ $interenc = mb_internal_encoding(); $inputenc = mb_convert_variables($interenc, "ASCII,UTF-8,SJIS-win", $post1, $post2); ?> PHP Documentation Group MB_CONVERT_VARIABLES(3)
All times are GMT -4. The time now is 05:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy