The below while loop is in ksh on a SunOs server: SPARC-Enterprise 5.10
The ksh version is: Version M-11/16/88i
The intention of the below while loop is to read through a list of file names in files.txt and
delete each file from a server, one at a time. The delete works, the problem is that if a file
does not exist the loop exits instead of issuing the read for the next file. The first file name
in files.txt does not exist, purposely to allow testing the routine for file not present.
Interestingly if the ssh cmd is removed and replaced with the execution of a non-existent
script the loop does not exit, it reads all files in files.txt. Why does the loop exit when ssh
tries to delete a file not on the server? I have tried various versions of trap with no success.
There is no break or exit in the script, which contains only the while loop.
Thanks, Lee
Last edited by Scott; 08-14-2013 at 04:26 PM..
Reason: Removed formatting
hi
i have two files
cat input.txt
123456| 43256
456482|5893242
cat data.txt
xv 123456 abcd dsk
sd 123456 afsfn dd
df 43256 asdf ff
ss 456482 aa
sf 5893242 ff ff
aa 5893242 aa aa
i need to read inputs from input.txt and find data for data.txt.
then i need to print them as a... (2 Replies)
hi all,
i have a while loop which i am using to read lines into an array:
k=0
exec 10<file
while read LINE <&10; do
ARRAY=$LINE
((k++))
done
exec 10>&-
echo ${ARRAY}
for some reason when i display the array it is not showing the last row in the file.
any help appreciated. (1 Reply)
I'm trying to run a set of commands on a remote machine using ssh in a shell script. One of the commands is unzip. But when the execution reaches this command, the script fails with an error that unzip is not found. Below is the code and the error snippet.
sourceDir=$1 ; filename=$3 ; destDir=$2... (4 Replies)
i have a script like below, i am trying to print "...." until a background process that was executed before is running,, the below does work and teh loop keeps on printing "..", can someone help where i am wrong.
/tmp/test/abc.sh &
until
do
echo "..\c"
done
abc.sh is the scipt... (8 Replies)
I'm trying to write a script using expect. I'd like the script to execute several commands when the ssh succeeds and i want it to exit if the ssh fails. Does this require to define a time out for the ssh command so that if the prompt is back before this defined time the next commands are executed??... (2 Replies)
Unable to set ssh passwordless authentication
I am unable to ssh with passwordless authentication from Windows client onto UBuntu server. The ssh version on UBuntu is OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e , while SSH on Windows Client is OpenSSH_5.1p1, OpenSSL 0.9.8k. I turned on ssh... (5 Replies)
Hi,
I am triggering a windows exe file using the below command.
ssh user@remoteserver command.exe -option1:xx /option2:yy
This command is working fine from windows command prompt. When I am triggering the same command from ssh I get the error message cant load
Any ideas to deal with... (2 Replies)
I have a constraint to follow organization policy. So i do not have much liberty.
ssh -i /opt/nonprod user1@hostone -t bash works while ssh -i /opt/nonprod -t bash user1@hostone fails
How can I get this to work when I am enforced to put -t bash before the user@hostname ?
Will share debug... (3 Replies)
I have two users on dest_host server viz wlsadm & wasadm.
From src_host server with root user I m able to passwordless login to wlsadm@dest_host however, the same fails for wasadm@dest_host
Below is the debug for both first the working ssh and then the non-working ssh.
Works:
... (6 Replies)
I have two linux servers viz 12.7.44.18 and 12.7.45.18
I wish to ssh from both these server to a destination AiX server 12.7.33.18
The ssh works from 12.7.44.18 -> 12.7.33.18 but fails from 12.7.45.18 -> 12.7.33.18
The openssl version on both linux source 12.7.44.18 and 12.7.45.18 is the... (7 Replies)
Discussion started by: mohtashims
7 Replies
LEARN ABOUT OPENSOLARIS
continue
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]
ksh93
+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 manual 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
variable assignment. This means that tilde substitution is performed after the = sign, and also that word splitting and file
name generation are not performed.
ksh93
break is a shell special built-in that exits the smallest enclosing for, select, while, or until loop. It also exits the nth enclosing loop
if n is specified. Execution continues at the command following the loop or loops.
If n is specified, it must be a positive integer >=1. If n is larger than the number of enclosing loops, the last enclosing loop is exited.
continue is a shell special built-in that continues execution at the top of the smallest enclosing for, select, while, or until loop, if
any; or of the top of the nth enclosing loop if n is specified.
If n is specified, it must be a positive integer >=1. If n is larger than the number of enclosing loops, the last enclosing loop is used.
On this manual page, ksh93(1) commands that are preceded by one or two + symbols are special built-in commands and are treated the follow-
ing 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. Built-in commands are not valid function names.
5. Words following a command preceded by ++ that are in the format of a variable assignment are expanded with rules as a variable
assignment. This means that tilde substitution is performed after the = sign and field splitting and file name generation 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), ksh93(1), sh(1), attributes(5)SunOS 5.11 8 Apr 2008 break(1)