10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi There,
var1=value1
var2=value2
var3=value3
for (( i=1; i<4; i++ ))
do
temp=var$i
echo "$temp"
done
OUTPUT
var1
var2
var3
I want the output to be
value1
value2 (5 Replies)
Discussion started by: jagpreetc
5 Replies
2. Shell Programming and Scripting
I want to create a conditional expression string and pass in an awk script. My script is as below...
comm="\$3 == "hello""
awk -F "^T" -v command="${comm}" ' {
if ( command ) { print "hye" }
}' testBut the statement "if ( command )" always evaluates to true which is not... (5 Replies)
Discussion started by: Saikat123
5 Replies
3. Shell Programming and Scripting
I am trying to write a simple function to select values from a database and assign them to variables. It can have any number of arguments sent into it, and I want to assign the value retrieved to a different variable name for each argument sent in. So my code looks something like this:
... (6 Replies)
Discussion started by: DJR
6 Replies
4. UNIX for Dummies Questions & Answers
In BASH, how does ||: get interpreted. I know || is logical or. And I believe : evaluates to true. Can someone give a thorough explanation for this usage?
Example
for i in $IGGY
do
&& skipdb=1 || : (6 Replies)
Discussion started by: glev2005
6 Replies
5. Shell Programming and Scripting
How to evaluate the value of a variable ?
For example:
a=var
$a=value !!!error happens!!!
I want to evaluate var=value, how to realize it?
Thanks!
---------- Post updated at 03:37 AM ---------- Previous update was at 02:22 AM ----------
I am using linux bash.
a=var
$a=value... (4 Replies)
Discussion started by: 915086731
4 Replies
6. Shell Programming and Scripting
Hello,
I have this:
#!/usr/bin/ksh
V1=ABC
str="hello 123;${V1}"
eval "echo $str"
i get
hello 123
/script.sh ABC not found
However eval works if $str variable doesn't contain a semicolumn (eg if str="hello 123~${v1}"
running the eval statement above would produce (2 Replies)
Discussion started by: endorphin
2 Replies
7. Shell Programming and Scripting
Hi, I am reading the contents of a file in variables as -
cat ${var_file_name} | while read COL1 COL2 COL3 COL4 COL5 COL6 COL7 COL8 COL9 COL10 COL11
The problem is ... my file can have any number of columns - 5, 10, 11 ....
So i want a dynamic variable list as -
cat ${var_file_name} |... (8 Replies)
Discussion started by: gopalss
8 Replies
8. Programming
Let's say for example that we have two different ways was can code the exact same program to achieve the same result.
What is the best way to determine which of the two methods is the best solution?
Is it as simple as basing it on how long the program takes to run or is there a more... (4 Replies)
Discussion started by: jmvbxx
4 Replies
9. Shell Programming and Scripting
I have variables:
FOO="Text"
BAR="FOO"
I'd like to be able to evaluate the variable named as the value of $BAR.
echo $FOO
Text
echo $BAR
FOO
This is what I'd like to do:
echo ${$BAR} (this won't work)
Text (3 Replies)
Discussion started by: Ilja
3 Replies
10. Shell Programming and Scripting
Probably a simple one.
Basically I am retrieving a number from a file - setting a variable against it and then incrementing this by 1 and using this as an entry number in a log file for messages. I need the variable to re-evalute itself each time I call it so I get the latest number in the file -... (1 Reply)
Discussion started by: frustrated1
1 Replies