I need to get the value of environment variable from awk begin. Then use that value as the start number of a sequence and use that in my print statement. But it is not reading the value from environment variable.
I have tried the following:
Calling script:
Note: $1 is the input file to be read and $2 is the output file the output is redirected
Called script:
Note: I am getting blank value into variable VAR even though I export the environment variable HOME in UNIX as "export HOME=100".
I am getting the output file data as
Starting_string,1,0667181535,1
Starting_string,2,0667181535,2
Starting_string,3,0667181535,3
But I expect it to come something as
Starting_string,1,0667181535,101
Starting_string,2,0667181535,102
Starting_string,3,0667181535,103
Using the variable HOME is not a good idea since this variable is set to the home directory by the shell.
For debug purpose, print the value of VAR in the BEGIN pattern.
If the value of VAR is not numeric, the first time you add one to VAR the variable will be set to 1 (non numeric value is trated as zero).
Using the variable HOME is not a good idea since this variable is set to the home directory by the shell.
For debug purpose, print the value of VAR in the BEGIN pattern.
If the value of VAR is not numeric, the first time you add one to VAR the variable will be set to 1 (non numeric value is trated as zero).
Jean-Pierre.
Thanks Jean-Pierre..
I have tried to set some env variable and but not being able to access it through ENVIRON..
Hi all
I am new to shell scripting. I need to read the 1st column and last of the excel file in linux environment.
Can some one help me with examples (3 Replies)
Hi,
I construct a bash script to finish some tasks. One of the task is to set up some environment variables. There is already one script file to complete the environment variables setting work. I am not able to know the detail of how to set these variables. So, I may just need to call this... (4 Replies)
Please help me on below..
https://www.unix.com/shell-programming-scripting/141533-retrieve-value-environment-variable-shell-script-called-crontab.html#post302442024
I'm still here. I can still see you! (0 Replies)
There are two files one is shell script (sample.sh) and another is configuration file (sampl_conf.cfg)
configuration file contains one variable $FTP_HOME. the value of this variable vaires for user to user. If user is say jadoo then value is /home/jadoo/ftp/, for user1 - /home/user1/ftp. The... (0 Replies)
Hi All,
I'm trying to write an menu driven program to automate some functions which involve loging to multiple hosts. The hosts can differ for every use, so I thought I would use an config file to get the hostnames. Now I need to set those values in the config file to environment variable to... (6 Replies)
Dear Unix gurus,
Perhaps I'm missing something,.....I'm having the most infernal difficulty getting AWK to read in an environment variable. For example,
value=5
awk '{print ""$value""}'
should return the number "5". This is not the case. Can somebody help?:confused:
cheers (7 Replies)
HI ,
In the below script I am trying to return the value of the environment variable TIBCO_HOME to the caller
#! /usr/bin/csh
set VAR_NAME=$1
echo VAR_NAME
On the aix console.. set to setenv TIBCO_HOME /app/tibco
When I execute the script... myscript.sh TIBCO_HOME, the script... (5 Replies)
Hi,
I am trying to set environment variable on a remote machine. I want to do it by running a shell script
Here's what I am doin
rsh <remote-hostname> -l root "cd /opt/newclient; . ./setp.sh"
In setp.sh, I have
#############################
cd ../newlib;
export... (1 Reply)
hi all
i have joined new to the group.
i have set an variable in my bashrc file.
.bashrc
PROGHOME=/home/braf/braf/prog
export PROGHOME
but while using it in my shell script its path is not taken and i had to explicitly give the export command to set the path.
in my script... (8 Replies)