Sponsored Content
Top Forums Shell Programming and Scripting Setting a variable in a stream of commands Post 302960097 by cjcox on Tuesday 10th of November 2015 03:02:15 PM
Old 11-10-2015
You're assumption is that final.enc can be run through a layer of evaluation.... so I'll stick with that assumption.... (and it's a big assumption!)

Code:
finalenc=`cat final.enc`
AgentDX=/tmp/tesfinal
eval echo "${finalenc}" | openssl aes-128-cbc -a -d -salt -k hello | sh

To avoid the evaluation, maybe a substitution would be better on the stream.
It would help (IMHO) if the AgentDX instead of being $AgentDX in final.enc , if instead it were ${AgentDX}. That's just a bit safer/easier on the parse.

then you could have:
Code:
AgentDX=/tmp/tesfinal
sed "s;\${AgentDX};${AgentDX};g" final.enc | openssl ... etc...

This User Gave Thanks to cjcox For This Post:
 

9 More Discussions You Might Find Interesting

1. Programming

setting CC variable

I am trying to install GCC-3.1.1 on an SGI Indigo2. I already have MIPSpro 7.2.1 installed. However, when I try to configure GCC-3.1.1, I get the message "cc ERROR: cc -o conftest -g failed, You must set the environment variable CC to a working compiler." What is the name of the MIPSpro c++... (1 Reply)
Discussion started by: mdbanas
1 Replies

2. UNIX for Dummies Questions & Answers

Setting a variable

I want to set a variable to be any number of dashes. Rather than doing the following: MYVAR="------------------" I'd like to be able to set the variable to, say, 80 dashes but don't want to have to count 80 dashes. Is there a way to do this? (2 Replies)
Discussion started by: photh
2 Replies

3. Shell Programming and Scripting

Variable setting help please

L=0 cat test.sh | while read line do L='expr $1 + 1' echo $L done echo $l >>> the echo $L at the end produces 0 but i actually want it to produce the number of lines - any idea why this is happening? (16 Replies)
Discussion started by: penfold
16 Replies

4. Shell Programming and Scripting

Setting variable

How do you set a varible with information that contains a string and also another variable? For example: subject="Attention: $name / This $type needs your attention" The $xxxx are of course other variables that I instantiated earlier. Is it like Java where you have to use double quotes and... (1 Reply)
Discussion started by: briskbaby
1 Replies

5. UNIX for Dummies Questions & Answers

setting a variable

In my script, I have the following command.... du -sk `ls -ltd sales12|awk '{print $11}'`|awk '{print $1}' it returns the value 383283 I want to modify my script to capture that value into a variable. So, I try doing the following... var1=`du -sk `ls -ltd sales12|awk '{print... (5 Replies)
Discussion started by: tumblez
5 Replies

6. UNIX for Dummies Questions & Answers

Interpreting java output stream as system commands in Solaris

Hi there again, Running Solaris 10 with built-in Java. Seems to compile and run fine. Problem is: Say I want to see contents of current directory. In a shell, I'd just write "ls" and it outputs the content. When I write a Java file, I have the following line: System.out.println("ls"); ... (1 Reply)
Discussion started by: EugeneG
1 Replies

7. Shell Programming and Scripting

[Video stream] network stream recording with mplayer

Hi I used this command: mplayer http://host/axis-cgi/mjpg/video.cgi -user root -passwd root \ -cache 1024 -fps 25.0 -nosound -vc ffh264 \ -demuxer 3 -dumpstream -dumpfile output.avi It's ok but... Video Playing is very fast! Why? Is it a synch problem? What parameter I have to use for... (1 Reply)
Discussion started by: takeo.kikuta
1 Replies

8. HP-UX

Setting printer paper length using unix commands

Hi Guys, I have been trying to resolve a printing problem but nothing works out . I have an Epson LQ 680 (dot matrix printer) . I need to print a file . The paper length should be 34 .Left margin should be 5. I have tried the following things after researching from the man pages. pr -t... (24 Replies)
Discussion started by: Kar1234
24 Replies

9. Shell Programming and Scripting

Problems setting or exporting variable when using multiple commands from same line.

I am experimenting with some scripting as a way to learn more about it. I have a simple script that calls two other scripts. Each script echos some stuff to prove it ran and then sets a simple variable and exports it. I cannot get one of the variables to display back in the main calling script... (2 Replies)
Discussion started by: scottrif
2 Replies
BIO_f_cipher(3) 						      OpenSSL							   BIO_f_cipher(3)

NAME
BIO_f_cipher, BIO_set_cipher, BIO_get_cipher_status, BIO_get_cipher_ctx - cipher BIO filter SYNOPSIS
#include <openssl/bio.h> #include <openssl/evp.h> BIO_METHOD * BIO_f_cipher(void); void BIO_set_cipher(BIO *b,const EVP_CIPHER *cipher, unsigned char *key, unsigned char *iv, int enc); int BIO_get_cipher_status(BIO *b) int BIO_get_cipher_ctx(BIO *b, EVP_CIPHER_CTX **pctx) DESCRIPTION
BIO_f_cipher() returns the cipher BIO method. This is a filter BIO that encrypts any data written through it, and decrypts any data read from it. It is a BIO wrapper for the cipher routines EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal(). Cipher BIOs do not support BIO_gets() or BIO_puts(). BIO_flush() on an encryption BIO that is being written through is used to signal that no more data is to be encrypted: this is used to flush and possibly pad the final block through the BIO. BIO_set_cipher() sets the cipher of BIO b to cipher using key key and IV iv. enc should be set to 1 for encryption and zero for decryption. When reading from an encryption BIO the final block is automatically decrypted and checked when EOF is detected. BIO_get_cipher_status() is a BIO_ctrl() macro which can be called to determine whether the decryption operation was successful. BIO_get_cipher_ctx() is a BIO_ctrl() macro which retrieves the internal BIO cipher context. The retrieved context can be used in conjunction with the standard cipher routines to set it up. This is useful when BIO_set_cipher() is not flexible enough for the applications needs. NOTES
When encrypting BIO_flush() must be called to flush the final block through the BIO. If it is not then the final block will fail a subsequent decrypt. When decrypting an error on the final block is signalled by a zero return value from the read operation. A successful decrypt followed by EOF will also return zero for the final read. BIO_get_cipher_status() should be called to determine if the decrypt was successful. As always, if BIO_gets() or BIO_puts() support is needed then it can be achieved by preceding the cipher BIO with a buffering BIO. RETURN VALUES
BIO_f_cipher() returns the cipher BIO method. BIO_set_cipher() does not return a value. BIO_get_cipher_status() returns 1 for a successful decrypt and 0 for failure. BIO_get_cipher_ctx() currently always returns 1. EXAMPLES
TBA SEE ALSO
TBA 0.9.8 2009-04-03 BIO_f_cipher(3)
All times are GMT -4. The time now is 08:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy