05-05-2012
The if statement is not valid syntax
Last edited by Scrutinizer; 05-05-2012 at 02:31 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi guys,
i have an array called ARRAY which has elements in it... i am trying to assign elements of ARRAY to master_array..
i get a =: command not found error..
i=0
while
do
${master_array}=${ARRAY}
((i++))
done
is there something i am missing? (4 Replies)
Discussion started by: npatwardhan
4 Replies
2. Shell Programming and Scripting
Hi!
Could someone explain me why the below code is printing the contents of IF block 5 times instead of 0?
#!/bin/bash
VAR1="something"
VAR2="something"
for((i=0;i<10;i++))
do
if(($VAR1=~$VAR2))
then
echo VAR1: $VAR1
echo... (3 Replies)
Discussion started by: machinogodzilla
3 Replies
3. Shell Programming and Scripting
Hey guys,
I'm kinda a noob at scripting. I am trying to create a script that uses multiple for loops with the lsiutility to monitor disk health on a system.
The script runs, but it will continually echo an infinite number of LogVolumes when there are only 2 per virtual disk on my server. It's... (2 Replies)
Discussion started by: tank126
2 Replies
4. UNIX for Dummies Questions & Answers
Hello All,
i have a really strange copy paste problem. When I write some loops in an editor for example:
for j in 1 2 3
do
echo "$j"
done
and I want to paste it to the shell, the result in the shell is:
for j in 1 2 3; do e;
other commands work fine and if a copy paste... (4 Replies)
Discussion started by: creamcheese
4 Replies
5. UNIX for Dummies Questions & Answers
Hi All,
I've been researching this problem and I am pretty sure that the issue is related to the while loop and the piping. There are plenty of other threads about this issue that recommend removing the pipe and using redirection. However, I haven't been able to get it working using the ssh and... (1 Reply)
Discussion started by: 1skydive
1 Replies
6. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Your shell script should continue to execute until the user selects option 4
2. Relevant commands, code,... (2 Replies)
Discussion started by: boyboy1212
2 Replies
7. Shell Programming and Scripting
Hi,
This is probably going to be very simple but i came across something i can't quite explain. Here is the situation: i have a list of files, which i'd like to process one by one (get the size, make some tests, whatever) and generate some statistics using different variables.
Something... (5 Replies)
Discussion started by: m69w
5 Replies
8. Shell Programming and Scripting
What is the proper way to run two bash loops in the same command? The two below loops run separately, the problem is when I pipe them I get an error that the file used for the second loop does not exist. I am not sure how to wait for the first loop to complete and then start the second. Thank... (10 Replies)
Discussion started by: cmccabe
10 Replies
9. Shell Programming and Scripting
Hello,
Below I try to control that the input is good an IP :
#!/bin/bash
cp /home/scripts/choice_interfaces.txt /home/scripts/interfaces.txt
chmod 644 /home/scripts/interfaces.txt
echo -e "Please enter the network informations into the /etc/network/interfaces file, complete them below... (9 Replies)
Discussion started by: Arnaudh78
9 Replies
10. Shell Programming and Scripting
I have 3 loops that I use to determine the permission level of AWS user accounts.
This array lists the AWS policy ARN (Amazon Resource Name):
for ((policy_index=0;policy_index<${#aws_managed_policies};++policy_index)); do
aws_policy_arn="${aws_managed_policies}"
... (1 Reply)
Discussion started by: bluethundr
1 Replies
break(1) User Commands break(1)
NAME
break, continue - shell built-in functions to escape from or advance within a controlling while, for, foreach, or until loop
SYNOPSIS
sh
break [n]
continue [n]
csh
break
continue
ksh
*break [n]
*continue [n]
DESCRIPTION
sh
The break utility exits from the enclosing for or while loop, if any. If n is specified, break n levels.
The continue utility resumes the next iteration of the enclosing for or while loop. If n is specified, resume at the n-th enclosing loop.
csh
The break utility resumes execution after the end of the nearest enclosing foreach or while loop. The remaining commands on the current
line are executed. This allows multilevel breaks to be written as a list of break commands, all on one line.
The continue utility continues execution of the next iteration of the nearest enclosing while or foreach loop.
ksh
The break utility exits from the enclosed for, while, until, or select loop, if any. If n is specified, then break n levels. If n is
greater than the number of enclosing loops, the outermost enclosing loop shall be exited.
The continue utility resumes the next iteration of the enclosed for, while, until, or select loop. If n is specified then resume at the n-
th enclosed loop. If n is greater than the number of enclosing loops, the outermost enclosing loop shall be used.
On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways:
1. Variable assignment lists preceding the command remain in effect when the command completes.
2. I/O redirections are processed after variable assignments.
3. Errors cause a script that contains them to abort.
4. Words that follow a command preceded by ** that are in the format of a variable assignment are expanded with the same rules as a vari-
able assignment. This means that tilde substitution is performed after the = sign, and also that word splitting and file name genera-
tion are not performed.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
csh(1), exit(1), ksh(1), sh( 1), attributes(5)
SunOS 5.10 17 Jul 2002 break(1)