Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to define multiple environment variables in a shell script? Post 303045862 by RudiC on Thursday 16th of April 2020 06:46:24 AM
Old 04-16-2020
Quote:
Originally Posted by sravani25
.
.
.
Can someone please help me on this issue.
.
.
.

What exactly is the issue? As always: pls describe the error meticulously, add error messages and misbehaviour.


What I can say from looking at your script is that shell variables are not expanded within single quotes, so neither $user_name nor $passwd values will be passed to the .*profile files. If that is by intention, make sure the vaiables are defined in those scripts.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script help: sorting, incrementing environment variables and stuff

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)
Discussion started by: secoif
1 Replies

2. Shell Programming and Scripting

problem accessing Multiple Variables from C Program to a Shell script

program name--test #!/bin/bash output1=`/home/user/a.c` output2=`/home/user/a.c` k=`$output1 + 1` m=`$output2 + 1` echo $k echo $m --------------------------------------------------------------------------- prgram name--a.c #include<stdio.h> int main() (1 Reply)
Discussion started by: sameworld1980
1 Replies

3. Emergency UNIX and Linux Support

Problem setting environment variables from script

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)
Discussion started by: ruben.rodrigues
10 Replies

4. UNIX for Dummies Questions & Answers

Define variables with UNIX script

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)
Discussion started by: macastor
5 Replies

5. Shell Programming and Scripting

environment variables in a sed script file

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)
Discussion started by: edgarvm
1 Replies

6. Shell Programming and Scripting

Using Datastage environment variables in Unix script

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)
Discussion started by: bghosh
1 Replies

7. Shell Programming and Scripting

Using a script to define variables and run multiple other scripts in succession.

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)
Discussion started by: bluejwxn8
1 Replies

8. Shell Programming and Scripting

Sourcing .cshrc (C shell) environment variables to bash

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)
Discussion started by: royalibrahim
6 Replies

9. Linux

How to store count of multiple queries in variables in a shell script?

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)
Discussion started by: sanvel
3 Replies

10. Shell Programming and Scripting

How to define two digits variable in shell script?

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
scha_resourcegroup_get(1HA)				       Sun Cluster Commands				       scha_resourcegroup_get(1HA)

NAME
scha_resourcegroup_get - access resource group information SYNOPSIS
scha_resourcegroup_get -O optag -G group [args] DESCRIPTION
The scha_resourcegroup_get command accesses information about a resource group that is under the control of the Resource Group Manager (RGM) cluster facility. This command is intended to be used in shell script implementations of the callback methods for resource types. These resource types repre- sent services that are controlled by the cluster's RGM. This command provides the same information as the scha_resourcegroup_get(3HA) C function. Information is generated by the command to standard output (stdout) in formatted strings as described in scha_cmds(1HA). The output is a string or several strings on separate lines. The output can be stored in shell variables and parsed using shell facilities or awk(1) for further use by the script. You need solaris.cluster.resource.read role-based access control (RBAC) authorization to use this command. See rbac(5). You must also be able to assume a role to which the Sun Cluster Commands rights profile has been assigned to use this command. Authorized users can issue privileged Sun Cluster commands on the command line from the pfsh(1), pfcsh(1), or pfksh(1) profile shell. A profile shell is a special kind of shell that enables you to access privileged Sun Cluster commands that are assigned to the Sun Cluster Commands rights profile. A profile shell is launched when you run su(1M) to assume a role. You can also use pfexec(1) to issue privileged Sun Cluster com- mands. OPTIONS
The following options are supported: -G group Name of the resource group. -O optag Specifies the information that is to be accessed. Depending on the optag that you specify, you might need to include an addi- tional operand to indicate the node or zone for which information is to be retrieved. Note - optag values, such as DESIRED_PRIMARIES and FAILBACK, are not case sensitive. You can use any combination of uppercase and lowercase letters when you specify optag options. The following optag values retrieve the corresponding resource group properties. The value of the named property of the resource group is generated. The RG_STATE property refers to the value on the particular node or zone where the command is executed. AUTO_START_ON_NEW_CLUSTER DESIRED_PRIMARIES FAILBACK GLOBAL_RESOURCES_USED IMPLICIT_NETWORK_DEPENDENCIES MAXIMUM_PRIMARIES NODELIST PATHPREFIX PINGPONG_INTERVAL RESOURCE_LIST RG_AFFINITIES RG_DEPENDENCIES RG_DESCRIPTION RG_IS_FROZEN RG_MODE RG_PROJECT_NAME RG_SLM_TYPE RG_SLM_PSET_TYPE RG_SLM_CPU RG_SLM_CPU_MIN RG_STATE RG_STATE_NODE RG_SYSTEM SUSPEND_AUTOMATIC_RECOVERY Note - RG_STATE_NODE requires an unflagged argument that specifies a node or zone. This optag value generates the value of the resource group's RG_STATE property for the specified node or zone. If the unflagged argument specifies a non-global zone, the format is nodename:zonename. EXAMPLES
Example 1 A Sample Script Using scha_resourcegroup_get The following script is passed a -G argument, which provides the required resource group name. Next, the scha_resourcegroup_get command is used to get the list of resources in the resource group. #!/bin/sh while getopts G: opt do case $opt in G) group="$OPTARG";; esac done resource_list=`scha_resourcegroup_get -O Resource_list -G $group` for resource in $resource_list do printf "Group: %s contains resource: %s0 "$group" "$resource" done EXIT STATUS
The following exit status codes are returned: 0 The command completed successfully. nonzero An error occurred. Failure error codes are described scha_calls(3HA). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscdev | +-----------------------------+-----------------------------+ |Interface Stability |Stable | +-----------------------------+-----------------------------+ SEE ALSO
awk(1), scha_cmds(1HA), scha_calls(3HA), scha_resourcegroup_get(3HA), attributes(5), rg_properties(5), rbac(5) Sun Cluster 3.2 6 Sep 2006 scha_resourcegroup_get(1HA)
All times are GMT -4. The time now is 07:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy