Sponsored Content
Top Forums Shell Programming and Scripting Unable to check if my command succeeded Post 302961695 by mohtashims on Wednesday 2nd of December 2015 01:41:39 PM
Old 12-02-2015
Error Unable to check if my command succeeded

Hi,

Is there a way to check if the openssl part of the below execution returns non zero without freezing the flow of the script ?

Code:
var1=$(echo | openssl s_client -connect $url 2>/dev/null | openssl x509 -noout -issuer -subject -dates)
echo $?

Output: 0

while i was expecting the output to be non zero for failing URLs.

I understand why the output shows 0 ... but what i wish to know is how can i grab the actual return code of openssl in the next line.

I tried something like
Code:
var1=$(echo | openssl s_client -connect $url 2>/dev/null | openssl x509 -noout -issuer -subject -dates)
->
openssl s_client -connect $url 2>/dev/null | openssl x509 -noout -issuer -subject -dates
or
test=$(openssl s_client -connect $url 2>/dev/null | openssl x509 -noout -issuer -subject -dates)

but both the above tricks freezes the flow and the script does not complete the while loop.

Can u help ?
 

10 More Discussions You Might Find Interesting

1. BSD

Unable to use 'su' command on FreeBSD6.2

Hi, I'm unable to do 'su' on my FreeBSD6.2 machine, I can remote ssh login as root but 'su' simply doesn't work at all. The message I get says that "The Operation Not Permitted". Requesting any help. Thanks in advance. (3 Replies)
Discussion started by: Praveen_218
3 Replies

2. UNIX for Dummies Questions & Answers

unable to use command line to cd or ls

Hi: I have a script with the next command line >set a=(grep -w "something" textfile.txt | grep -w "anotherthing" | cut -c1-11) In the file textfile.txt there are some file names and their paths so when I use this command line it returns a path, for example /directory, and stores in a. ... (3 Replies)
Discussion started by: bosh
3 Replies

3. Shell Programming and Scripting

How to tell if "find" command has succeeded ?

It seems that regardless of finding or not finding the file find's exist status is 0. How can i tell (in a shell script) if find has actually found the file ? sameagain-lm:~ $find /opt/cisco-vpnclient /opt/cisco-vpnclient /opt/cisco-vpnclient/bin /opt/cisco-vpnclient/bin/cisco_cert_mgr... (3 Replies)
Discussion started by: hiphamster
3 Replies

4. Solaris

Unable to check / filesystem

Hi buddies, I have T1000 and Solaris 10 installed on it. After a power failure system shut down improperly. Error Message is WARNING - Unable to repair the / filesystem. Run fsck manually (fsck -F ufs /dev/rdsk/c0t0d0s0). Jul 18 10:16:09 svc.startd:... (6 Replies)
Discussion started by: ahsen
6 Replies

5. Shell Programming and Scripting

grep functions, how to test if succeeded

Hello ...again. I am stuck on this part, I have a loop with processes an operations file. and calls different functions depending on what is in loop, which processes a database file... #so far my add function works as intended add() { ...blah blah; } # delete is kinda working... (13 Replies)
Discussion started by: gcampton
13 Replies

6. UNIX for Dummies Questions & Answers

tar unable to use command

Hello all... i am unable to use tar commands on my intel machine in solaris 10 by tying this "tar cvf /dev/rmt/mydata.tar/mydata" and created mydata directory, msg is "No:Missing Files" Please advise (5 Replies)
Discussion started by: VijaySolaris
5 Replies

7. AIX

Unable to execute snap command

Hi Friends, I am not able to execute snap -a command in AIX 6 system. Could you please let me know how to make work this command and Path to be set. Thanks in Advance Siva. (4 Replies)
Discussion started by: sivakumarl
4 Replies

8. Shell Programming and Scripting

Script to check one command and if it fails moves to other command

Input is list of Server's, script is basically to remove old_rootvg, So it should check first command "alt_rootvg_op -X old_rootvg" if it passes move to next server and starts check and if it fails moves to other command "exportvg old_rootvg" for only that particular server. I came up with below,... (6 Replies)
Discussion started by: aix_admin_007
6 Replies

9. Shell Programming and Scripting

Unable to check if file exists on remote server using expect

Hi, I need to check if a file exists on remote server using expect. #!/bin/bash ip_addr=10.10.10.10 user=root passwd=Help filename=/root/test expect -c " spawn ssh -n -T -o NumberOfPasswordPrompts=3 -o StrictHostKeyChecking=no $user@$ip_addr expect \"*?assword:*\" send --... (6 Replies)
Discussion started by: temp_user
6 Replies

10. Shell Programming and Scripting

Command to check only Autosys running jobs with autorep like command

Hi, Is there any specific command to use to check only say Running jobs via autorep or similar command for Autosys? (0 Replies)
Discussion started by: sidnow
0 Replies
CRL(1SSL)							      OpenSSL								 CRL(1SSL)

NAME
openssl-crl, crl - CRL utility SYNOPSIS
openssl crl [-help] [-inform PEM|DER] [-outform PEM|DER] [-text] [-in filename] [-out filename] [-nameopt option] [-noout] [-hash] [-issuer] [-lastupdate] [-nextupdate] [-CAfile file] [-CApath dir] DESCRIPTION
The crl command processes CRL files in DER or PEM format. OPTIONS
-help Print out a usage message. -inform DER|PEM This specifies the input format. DER format is DER encoded CRL structure. PEM (the default) is a base64 encoded version of the DER form with header and footer lines. -outform DER|PEM This specifies the output format, the options have the same meaning and default as the -inform option. -in filename This specifies the input filename to read from or standard input if this option is not specified. -out filename Specifies the output filename to write to or standard output by default. -text Print out the CRL in text form. -nameopt option Option which determines how the subject or issuer names are displayed. See the description of -nameopt in x509(1). -noout Don't output the encoded version of the CRL. -hash Output a hash of the issuer name. This can be use to lookup CRLs in a directory by issuer name. -hash_old Outputs the "hash" of the CRL issuer name using the older algorithm as used by OpenSSL before version 1.0.0. -issuer Output the issuer name. -lastupdate Output the lastUpdate field. -nextupdate Output the nextUpdate field. -CAfile file Verify the signature on a CRL by looking up the issuing certificate in file. -CApath dir Verify the signature on a CRL by looking up the issuing certificate in dir. This directory must be a standard certificate directory: that is a hash of each subject name (using x509 -hash) should be linked to each certificate. NOTES
The PEM CRL format uses the header and footer lines: -----BEGIN X509 CRL----- -----END X509 CRL----- EXAMPLES
Convert a CRL file from PEM to DER: openssl crl -in crl.pem -outform DER -out crl.der Output the text form of a DER encoded certificate: openssl crl -in crl.der -inform DER -text -noout BUGS
Ideally it should be possible to create a CRL using appropriate options and files too. SEE ALSO
crl2pkcs7(1), ca(1), x509(1) COPYRIGHT
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>. 1.1.1a 2018-12-18 CRL(1SSL)
All times are GMT -4. The time now is 03:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy