Hi there, i think im getting myself a little confused and need some help
I am reading in a bunch of variables to my script from an external file and need to validate that a value has been set for each
so if you can imagine, the user is required to pass in 4 values username,password,uid and gid. these get set to
$USER
$PASS
$UID
$GID
now this is fine, however I want to write a little loop that tests for its existence and echos an error if its not set. I appreciate I can do this as individual lines, but in reality there are more than 4 variables, there are hundreds, so id like to do it in a loop
so the idea being something like
now i realise that this wont work because when $i is expanded it is just a string and not another varuable, but ive tried
and
etc
would I need to use 'eval' and if so, can someone give me an example of how i would do this?
Hi guys,
I have a file "abc.dat" in below format:
FILE_PATH||||$F_PATH
TABLE_LIST||||a|b|c
SYST_NM||||${SRC_SYST}
Now I am trying to read the above file and want to print the value for above dollar variables F_PATH and SRC_SYST. The problem is it's reading the dollar variables as... (5 Replies)
Hi,
I am trying to do the following thing
var='date'
$var
Above command substitutes date for and in turn runs the date command and i am getting the todays date value.
I am trying to do the same thing as following, but facing some problems,
unique_host_pro="sed -e ' /#/d'... (3 Replies)
Does anyone know of a way to force a variable name held in another variable to return the value of the first variable? Best if I give an example, that does not work:
/usr/local/bin >cat mike.sh
NUM1ref=16
NUM2ref=32
echo "=============="
for VAR in NUM1 NUM2
do
XXXX=${VAR}ref
echo $XXXX... (4 Replies)
Hi Gurus
I have a file called /tmp/CMDB which looks like this
serial: 0623AN1208
hostname: server1
model: x4100
assetID: 1234
I am writing a for loop that will go through this file line by line creating a variable of itself. Using the first iteration of the loop (i.e. the first line) as... (6 Replies)
Any help would be great. I know this is a dumb way of doing this, but I would like to know if there is a solution doing it this way. I'm very new at this and I'd like to learn more. Thanks! :D:D
count=0
while ; do
echo "enter your name"
read name_$count
let count=count+1
done
... (2 Replies)
Hi,
I have the following requirement.
V="First"
R="V"
echo $$R
The output should be First. How do i achieve this.
how do we evaluate the $R and evaluate it to $V as $R contains V
and $V is First.
Thanks
Vijay (2 Replies)
Hello, i'm unable to write a correct if... statement to evaluate the $? variable.
Could anybody send to me an example? for example, this lines of code didn't work...
if ; then
etc etc
if ; then
etc etc
Thank you in advanced. (5 Replies)
I would like to know how to pass a variable inside a variable to a function.
sample code below
--------------
for x in 1 9
do
check_null $C$x ##call function to check if the value is null
if
then
echo "line number:$var_cnt,... (2 Replies)
hi sir,
i need your help for this script
inside /rnmucdr/ednms05/ken/xMNBDF045_Script.sql content variable like this
select * from invoice where bill_date=$BILLDATE and startNum=$STARTPARTNNUM and total_partn=$TOTALPARTN
if i just paste this replace with the $SCRIPT it works great,if... (31 Replies)