![]() ![]() It should almost certainly be ssh v0021x91 ls /apps/oracle/home/DB_1201/*.dmp Don't specify wildcards in the target unless you really really know what you're doing.What's with the spaces in the target component?. ![]() In practical terms it's probably ok, but you should use or instead. You're using a string comparison for numeric values. Using large or negative numbers is erroneous and misleading Or, if you're writing for bash, ]Įxit codes should either be 0 (success, ok) or in the range 1-127. As a side effect it will output no files to wc -l and you'll get zero as the expected and correct result there.įinally, the test will match either zero files along with an error written to stderr, or some non-zero number of files.Īs a point of modern coding, consider replacing with. If there are no matching files, ls will complain with an error that it cannot find the file /apps/oracle/home/DB_1201/*.dmp (complete with a literal asterisk as the first character of the file name). The remote shell will then evaluate the pattern before executing the ls command, either expanding it to one or more matching files or leaving it as a literal asterisk. Otherwise, the asterisk will remain and be passed to the remote side as literal. ![]() If /apps/oracle/home/DB_1202/*.dmp matches one or more files on the local host, it will be replaced with the name(s) of those file(s). The evaluation order is such that the wildcard is evaluated before the ssh command is executed. If scp -rp /apps/oracle/home/DB_1201/*dmp -e " SCP Success" scp -rp /apps/oracle/home/DB_1201/*.dmp Įcho -e " Can't copy files from Source to Remote" Please advise on the correct approach of executing the SCP and after that validating its status?īelow always returns zero even if some error as its taking local server last command status. Need to return file count 0 or 28 and/or capture directory not found error. I need output of "ls /apps/oracle/home/DB_1201/*.dmp |wc -l" 0 or N number.Īnd if directory is not there (No such file or directory). dmp exists ) if ssh v0021x91 ls /apps/oracle/home/DB_1201/*.dmpįor below "then" part is executed with $? =0 when actual error "ls: cannot access /apps/oracle/home/DB_1201/*.dmp: No such file or directory" if Įcho " Dumps Files Cleaned Up on Remote Host" I want to check if files count is 0 on Remote server using ssh.īelow code is only checking if file (ending with. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |