.
.
.
when i executed the shell script it's executed successfully but when i am trying to print the environment variable it's returning empty value echo $NAME -- is giving empty value.
$NAME being empty is a strong indicator that $user_name is empty and the "command substitution" fails / results in an empty string. I guess its because the file called $abc doesn't exist. and the cat cats nothing.
Quote:
Can you please let me know what i need to change to set the environment variable ?
It would help if people knew the entire scenario. Variables in which environment do you want to set? Your current session? Future sessions? Why the echoing into the varying .profiles?
First: me == noob. Whats a good resource for shell script info cause I'm having trouble finding good info.
I'm writing a shell script to automate the setup of a flash 'page flip'.
My current code is below.
the page flip takes an xml file of format
<content>
<pages... (1 Reply)
Hi all!
I know that environment variables can be set on the .bashrc file, but I need to set them from a sh script. I saw a lot of websites that teach this but it doesn't work for me.
#!/bin/sh
DEKTOP=$DESKTOP=:/home/rrodrigues/Desktop
export DESKTOP
if I do echo $DESKTOP returns me... (10 Replies)
oopps! I Meant "Define Variables within a UNIX Script"
What would be the best way to define a variable in a unix shell script so anyone who views this script doesn't know what value is assigned to that variable.
some other location...
a="/usr/lib/fileA"
Unix script...
sed... (5 Replies)
Hello Everyone
I need to create a script file which must append some lines to a target text file, I'm using sed for windows, the script file look like this:
{
a\
STRINGTABLE DISCARDABLE\
BEGIN\
5, 150 {a\
#define RC_SHELL, "%ID_SHELL%"\
#define RC_NAME, "%ID_NAME%"\
END
}
... (1 Reply)
Hi All,
I am using ETL tool Datastage and is installed on Linux environment. Few environment variables are set in datastage. Now my requirement is to use those environment variables in a unix script.
Is there any option I can do it?
Sugeestions from people working on datastage and linux... (1 Reply)
I'm pretty new to scripting in Korn shell so please forgive me...
What I'm trying to do is to create a script that calls multiple other ksh scripts and defines variables for text files.
I need it to define my user defined variables (file paths, date & time stamps, etc that are currently in... (1 Reply)
I have tried with the following:
csh -c 'source ~/.cshrc; exec bash' # works perfectly
(cat ~/.cshrc; echo exec bash) | csh # not working
And, using sed, I successfully retrieved the environment variables from ~/.cshrc
sed -rn 's/setenv\s+(\S+)\s+(.*)$/export \1=\2/p' ~/.cshrc
but now... (6 Replies)
how to store the count of queries in variables inside a filein shell script
my output :
filename
-------
variable1=result from 1st query
variable2=result from 2nd query
.
.
.
. (3 Replies)
Dear Shell script Experts,
I am working on shell script which is defined here, qsub_seq.csh . The purpose of this script is to read few input files (with defined starting index and last index) and make processing faster over server.
For some task, I had 1064 of input files, so I wrote another... (8 Replies)
Discussion started by: emily
8 Replies
LEARN ABOUT HPUX
setenv
setenv(3C)setenv(3C)NAME
setenv(), unsetenv() - add, update or remove an environment variable
SYNOPSIS
Parameters
envname Points to a string containing the name of an environment variable to be added or altered. This should not be a NULL
pointer or null string, and the string should not contain an equal character.
envval Points to a string containing the value to be set for the variable envname.
overwrite Indicates whether to overwrite the value of envname variable or not, if it already exists. Expected values are non-zero
and zero. If the environment variable does not exist in the environment, then the value of this variable is ignored.
DESCRIPTION
and functions update the environment of the calling process.
If envname does not exist, the function ignores the value of overwrite and adds the variable envname to the environment with the value
envval. If envname exists and overwrite is non-zero, then the variable envname is updated with the new value envval. If envname exists
and overwrite is zero, then the variable is not updated, and the function is considered to have completed successfully.
The function deletes the variable envname from the environment, if it exists. If the envname variable does not exist in the current envi-
ronment, the environment is unchanged, and the function is considered to have completed successfully.
If the application modifies environ or the pointers to which it points, the behavior of and is undefined.
EXTERNAL INFLUENCES
Locale
The category determines the interpretation of characters in string as single- and/or multi-byte characters.
International Code Set Support
Single- and multi-byte character code sets are supported.
RETURN VALUE
The and functions return zero on success; otherwise they return and set to indicate the error.
ERRORS
If the function fails, is set to one of the following values:
Sufficient memory is not available to add a variable or its value to
the environment.
The envname argument is a null pointer, points to an empty string, or points to a string containing an equal character.
If the function fails, is set to the following value:
The envname argument is a null pointer, points to an empty string, or points to a string containing an equal character.
EXAMPLES
The following code adds a new environment variable to the current environment.
The following code updates the variable
The following code removes the variable from the current environment.
WARNINGS
The and functions manipulate the environment pointed to by environ, and can be used in conjunction with However, envp (the third argument
to main) is not changed.
The uses to enlarge the environment (see malloc(3C)).
After the or function is called, environment variables may not be in alphabetical order.
AUTHOR
and were developed by HP.
SEE ALSO exec(2), getenv(3C), malloc(3C), putenv(3C), environ(5), thread_safety(5).
STANDARDS CONFORMANCE setenv(3C)