10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I'm trying to build a small script to store a command into a dynamic variable, and I have trouble assigning the variable.
#!/bin/bash
declare -a var1array=("value1" "value2" "value3")
var1arraylength=${#var1array}
for (( i=1; i<${var1arraylength}+1; i++ ));
do
mkdir... (7 Replies)
Discussion started by: alex2005
7 Replies
2. UNIX for Advanced & Expert Users
I have a below syntax its working fine...
var12=$(ps -ef | grep apache | awk '{print $2,$4}')
Im getting expected output as below:
printf "%b\n" "${VAR12}"
dell 123
dell 456
dell 457
Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Discussion started by: sam@sam
5 Replies
3. UNIX for Dummies Questions & Answers
I am trying to create some variables based on the input by the user, say if user entered 3 then 3 variables and if 5 then 5 variables.
I am using a for loop
for (( i=1; i <= $num; i++ ))
do
x="num"
x+=$i
done
When i am using echo $x it will show num1 but now how to create variables... (3 Replies)
Discussion started by: Raj999
3 Replies
4. Shell Programming and Scripting
Hi guys.
i have a requirment as below.
I have a scripts which perform for loop
for i in /backup/logs -- it will give all the logs file
SC_RIO_RWVM_20120413064217303.LOG
SC_RIO_RWXM_20120413064225493.LOG
SC_RIO_RXXM_20120413064233273.LOG
...
do
open script.sh ---- in this file... (3 Replies)
Discussion started by: guddu_12
3 Replies
5. Shell Programming and Scripting
I need some variable help
TEMP1=Jane
TEMP2=Sue
X=1
eval USER=TEMP${X}
echo $USER
This gives output USER1
I would like to get Jane
I have tried
eval USER='TEMP${X}'
eval USER="TEMP${X}"
eval USER=`TEMP${X}` (3 Replies)
Discussion started by: Jotne
3 Replies
6. Shell Programming and Scripting
Hi all,
I’m very new to UNIX programming. I have a question on dynamic variable
1. I’m having delimited file (only one row). First of all, I want to count number of columns based on delimiter. Then I want to create number of variables equal to number of fields.
Say number of... (5 Replies)
Discussion started by: mkarthykeyan
5 Replies
7. Shell Programming and Scripting
I found one post in another site with a solution for my problem
the below solution should explain what I want.
#!/bin/sh
first="one"
second="two"
third="three"
myvar="first"
echo ${!myvar}
But this gives error 'bad substitution'
System info
SunOS sundev2 5.9... (3 Replies)
Discussion started by: johnbach
3 Replies
8. Shell Programming and Scripting
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)
Discussion started by: reconflux
2 Replies
9. UNIX for Dummies Questions & Answers
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)
Discussion started by: KingVikram
2 Replies
10. Shell Programming and Scripting
Evening all,
Have been trying to create the following environment variable:
${MD_SYSTEM}_ZZ_EMAIL_SUPPORT="myname@domain.com"
However when the script that contains the above is executed it returns:
ksh: MDQA_ZZ_EMAIL_SUPPORT=myname@domain.com: not found
Is what I'm trying to do... (2 Replies)
Discussion started by: Cameron
2 Replies