Getting a variable and output to use later on in script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Getting a variable and output to use later on in script
# 1  
Old 01-14-2013
Getting a variable and output to use later on in script

Hi Guys!

I'm trying to get this script going but running into a little issue. not sure what is going on.

basicly how i'm writing this script is to ask you what is the password you want to be encrypted, then ask you what the user id is, takes that info run's the encryption script with the password requested and outputs it to a file.

can someone see why it's not working.:

Code:
#!/bin/ksh

print -n What is the requested password to be encrypted? -
read CRYPT

print -n What is the user id: -
read UID

VAR=/apps/mkusr/crypt.pl ${CRYPT} mypassword

echo "${UID}:${VAR}:tester" > test
exit 0

# 2  
Old 01-14-2013
For the VAR assign line try:

Code:
VAR=$(/apps/mkusr/crypt.pl ${CRYPT} mypassword)

This User Gave Thanks to Chubler_XL For This Post:
# 3  
Old 01-15-2013
Quote:
Originally Posted by Chubler_XL
For the VAR assign line try:

Code:
VAR=$(/apps/mkusr/crypt.pl ${CRYPT} mypassword)


that did the trick thank you!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to copy script output to a variable using same script?

I'm trying to copy script output and use it in this same script as a variable, and call the variable when script is compiled. The script is below. #!/bin/bash output=$(script) while read line; do if ]; then grep "$line" logfile.txt # Create text file echo "From: IT ... (4 Replies)
Discussion started by: SysAdminRialto
4 Replies

2. AIX

Oracle output to an array variable in script

Hi- I am returning output of an query into a array variable in my shell script. set -A DATE_RANGE `sqlplus -s **/**@** << EOF set termout off set echo off set serveroutput off set pagesize 0 set linesize 500 set heading off set verify off set feedback off select... (1 Reply)
Discussion started by: vputtas@gmail.c
1 Replies

3. UNIX for Dummies Questions & Answers

is there a way to assing variable a value that is output of a program in awk script?

Hi there is there a way to assing variable a value that is output of a program in awk script. For e.g., I did temp=(`grep "" $5 | cut -f8 -d' '`) but it does not work. Any advice??? Thanks in advance!!! :) (3 Replies)
Discussion started by: FUTURE_EINSTEIN
3 Replies

4. Shell Programming and Scripting

Output of matlab as a variable for shell script

I'm running a matlab code within a shell script. This is how I do it, matlab -nodesktop -nosplash -nojvm -r "my_program;quit" This works fine. My matlab code prints out a single number, say "ans = 10" for example. I want to assign this to a variable in the shell script. I tried doing this... (18 Replies)
Discussion started by: lost.identity
18 Replies

5. Shell Programming and Scripting

[Solved] Output in bash script not captured in variable

I'm tring to write down a simple script that would execute a command and wait until it returns a specific result. This is what i did: bjobs_out=`bjobs` while ]; do bjobs_out=`bjobs` sleep 6 done It seems to work until the command 'jobs' return the list of jobs in execution, but... (4 Replies)
Discussion started by: lifedj
4 Replies

6. Shell Programming and Scripting

Capturing output of procedure in variable in shell script

Hi guys I am calling one DB2 stored proc through unix. It is giving me below output. I want to capture the value 150 in one UNIX variable in shell script. Please let me know how I can achieve this. Thanks in advance Value of output parameters -------------------------- Parameter Name :... (5 Replies)
Discussion started by: vnimavat
5 Replies

7. Shell Programming and Scripting

How to give a variable output name in a shell script inside a for loop

Hi all I run my program prog.c in the following way : $ ./prog 1 > output.txt where 1 is a user defined initial value used by the program. But now I want to run it for many a thousand initial values, 1-1000, and store all the outputs in different files. Like $ ./prog 1... (1 Reply)
Discussion started by: alice06
1 Replies

8. Shell Programming and Scripting

how to assign the output of the interective script to the variable

Hi, I work in ksh88. I have an interective script which prompts the user for the input and returns numeric value depending on the input provided. I need to call this script inside another script and then assign the resulting output the the variable. The call like that A=`my script` obviously... (6 Replies)
Discussion started by: aoussenko
6 Replies

9. UNIX for Dummies Questions & Answers

Storing lines of output into a script variable

I'm sure this is a simple thing but I can't figure it out. In a script that I'm writing, I'd like to be able to store each line of output from "ls -l" into a variable. Ultimately I'd like to end up with something like: for a in `ls -l` do something with $a doneBut that's reading each... (2 Replies)
Discussion started by: ewoods
2 Replies

10. UNIX for Dummies Questions & Answers

ls command output to variable in script

Hi, I wrote a script to get the oldest file from a directory path (which is passed as a parameter to the script) ######################################################### XMLFILE_PATH={$1} cd $XMLFILE_PATH JPM_FILENAME = `(ls -tr User* | head -1)` #echo $JPM_FILENAME ###### END... (1 Reply)
Discussion started by: dsrookie
1 Replies
Login or Register to Ask a Question