01-23-2011
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I'm having some trouble with the syntax in constructing a simple nested 'for' loop.
My code is as follows:
#!/bin/bash
dir1="fred flume haystack"
for dir2 in ${dir1}
do
fred="1 2 3"
flume="a b c"
... (7 Replies)
Discussion started by: Sn33R
7 Replies
2. UNIX for Dummies Questions & Answers
if ]; then
if ]; then
rm -f ${LOGFILE}.old
fi
mv ${LOGFILE} ${LOGFILE}.old
fi
Havent done nested ifs in a while. I'm reading someones code If I'm reading this correctly. It checks for the logfile, and if it exists it checks for the old logfile and if that exists, it removes the... (8 Replies)
Discussion started by: NycUnxer
8 Replies
3. Shell Programming and Scripting
Hello.
I have the following problem with bash code:
function fl1_load_modules_and_get_list()
...........
for module in $FL_MODULES_TO_PROCESS
do
source "${FL_MODULE_DIR}/${module}/module.sh"
done
...........
}
function fl1_handle_install
{
local... (12 Replies)
Discussion started by: FractalizeR
12 Replies
4. UNIX for Dummies Questions & Answers
Here's the input:
alpha, numeric or alphanumeric string ("line 1 string")
numeric string ("line 2 string")
numeric string ("line 3 string")
numeric string ("line 4 string")
...
where
- each numeric string is in a pattern that can be matched with RE but
- there can be any number of... (2 Replies)
Discussion started by: uiop44
2 Replies
5. Shell Programming and Scripting
Hi,
How to use values in one for loop to other for loop.
say "$sf_rel" variable has values "2011/W2 2011/G2" I want to use these values in inner for loop to process properly.
$branch variable has G2 and 6
What is happening is outer for loop $i has 2011/W2 it is entering into inner... (3 Replies)
Discussion started by: Anjan1
3 Replies
6. Shell Programming and Scripting
Please tell me how to nest logical expressions in bash. I would like to nest logical expressions for arguments of the "test" command on bash.
The following pseudo-code shows my intention.
// pseudo code
if (exp1 AND (exp2 OR exp3))
{
Output true;
}
else
{
Output false;
}
... (11 Replies)
Discussion started by: LessNux
11 Replies
7. Shell Programming and Scripting
Ok, this one isn't for everybody, it's pretty tough and I've spent a good deal of time on it without figuring it out yet.
Can anybody get this script to work:
#!/bin/bash
cq_fname="%let outputfile="/user/cq_"$1".csv";"
sed "29s/.*/\"$cq_fname\"/" file1.sas >... (3 Replies)
Discussion started by: nocloud
3 Replies
8. Shell Programming and Scripting
Folks - newbie bash coder here and I'd like to get your help to make the code below work. As you can see, I was trying to count the total number of lines with the 3rd value >= 15 in a file and wanted to make the threshold "15" configurable, but apparently the $THRESHOLD value was not populated... (3 Replies)
Discussion started by: bashzipper
3 Replies
9. Shell Programming and Scripting
In a bash script I have:
LSCMD="find /project/media/ -mindepth 2 -maxdepth 2 -name \"files*pkg\""
ALL_PACKAGES=$( $LSCMD | sort 2>/dev/null)
But I get nothing returned. It's just all blank. If I run the find command in a terminal, I get dozens of hits.
I figure it's the way how I'm... (3 Replies)
Discussion started by: superbbrr
3 Replies
10. UNIX for Dummies Questions & Answers
I am using the following nested loop
for i in {1..3}
do
for y in {1..3}
do
if ;
then
echo P0${i}R${y}.fas
mv P0${i}R${y}.fas P${i}R${y}.fas
read -t 5
fi
done
done
I was wondering if I can use a character such as * or ? instead of my second variable y. I tried R in... (3 Replies)
Discussion started by: Xterra
3 Replies