03-08-2017
I'm afraid that code snippet can't possibly run flawlessly:
- the continuation ( \ ) between for ... and do needs to be dropped
- done missing
- esac missing
And, looking at the for construct, file will assume string values like ...csv or ...txt, which will never match sun_detail nor sum nor mod.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
This code has worked for years and still does in my production environment. But it's failing in my development environment now. The cd works but the creation of node1, jnum, and node2 fails. Oddly the output shows a line from from the awk script at the end of the code during the setting of each... (6 Replies)
Discussion started by: gillbates
6 Replies
2. Shell Programming and Scripting
how to use if-loop in bourne shell with multiple conditions like follows
if
then
commands
fi
it gives me an error
test: ] missing
then i put
if ]
it gives me an error
[[ not found
kindly i need the syntex for the bourne shell (5 Replies)
Discussion started by: ahmad.diab
5 Replies
3. Shell Programming and Scripting
i have this code for a simple if loop:
#!/bin/bash
array="1 2 3 4 5"
array2="5 6 7 8 9"
if } -gt ${array} ]; then
echo "${array2} is greater than ${array}!!"
fi
the error is
./script8: line 9: [: too many arguments
./script8: line 9: [: too many arguments
./script8: line 9: [:... (10 Replies)
Discussion started by: npatwardhan
10 Replies
4. UNIX for Dummies Questions & Answers
It is happening with my sessions already second time: a 'for'-loop for some reason stop to work as expected.
That means or it is looping without exitting, or it is not loop even once.
Here example of my try when it is not processing even one loop.
You can see, I start new subshell and... (14 Replies)
Discussion started by: alex_5161
14 Replies
5. Shell Programming and Scripting
Hello Everyone....
I am trying to print a number sequence in following format using for loop.
I am using a bourne shell. I tried following for loop condition but it is bash syntax.
for (( i=0; i<=5; i++ ))
It is giving syntax error.
Kindly help with the syntax of "for"... (7 Replies)
Discussion started by: EmbedUX
7 Replies
6. Shell Programming and Scripting
Hi-
Here is the shell script that for some reason is not returning results:
#! /bin/ksh -
avg() {
AVG=0
typeset SUM=0
if
then
echo "You must have at least two numbers"
else
for NUM in "$*"
do
... (2 Replies)
Discussion started by: koomba
2 Replies
7. Shell Programming and Scripting
Hello
I am having issues with a script I'm working on developing on a Solaris machine.
The script is intended to find out how many times a particular user (by given userid) has logged into the local system for more than one hour today.
Here is my while loop:
last $user | grep -v 'sshd'... (7 Replies)
Discussion started by: DaveRich
7 Replies
8. Shell Programming and Scripting
for (( i=1; i<=3; i++ )); do
for (( j=1; j<=3; j++ )); do
for (( k=1; k<=3; k++ )); do
echo $i$j$k
done
done
done
Will the above code work on a BOURNE shell?
As far as my understanding is, if I am writing the above code in a file..say lol.sh and then running it through the terminal using... (7 Replies)
Discussion started by: navienavnav
7 Replies
9. Shell Programming and Scripting
Hi
I'm using this script to transcode videos in an Ubuntu 12.04 machine.
#! /bin/bash
MOVDIR="/media/topaz_1/media/transcodes/transcode_mov/"
MOVDESTDIR="/media/topaz_1/media/transcodes/final_mov/"
DONEFILESDIR="/media/topaz_1/media/transcodes/dv_cache/"... (1 Reply)
Discussion started by: oscarfelson
1 Replies
10. Solaris
Hi,
Please assist me why HC alias is not working under this shell?
root@singapore # grep HC /.profile
alias HC='cd /var/tmp/HC/2015/`date +%B`'
root@singapore # . /.profile
Sourcing //.profile-EIS.....
root@singapore # echo $HC
root@singapore # HC
HC: not found
root@singapore # echo... (18 Replies)
Discussion started by: tprabhu1983
18 Replies