Help on passing an input variable to the voronota program (after third pipe)


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Help on passing an input variable to the voronota program (after third pipe)

Dear UNIX forum members,

I am using macbook pro 13 (2015 edition) with MAC OS Mojave and am trying to write the shell script where when it is run through terminal it asks for an input (in the code below an input variable is domains) and then that input becomes capital letter or letters which voronota program requires (so instead of 'c<domains>' it should be 'c<C,D>' or any other letter combinations when the voronota program is run at the third pipe). The code is given below :

Code:
#!/bin/bash
for i in $( ls ); do
    echo $i
    read -p "Domains: " domains
    cat $i | voronota get-balls-from-atoms-file --annotated | voronota calculate-contacts --annotated | voronota query-contacts --match-first 'c<$domains>' --match-second 'R<ALA>' | awk '{sum += $3} END {print sum}'
done

I am expecting to get 1.18715 after awk prints the value to the terminal, but in the above code I do not get any value which signals to me that when I write C,D after shell asks "Domains: " the written input is not passed to the variable domain at:

Code:
... | voronota query-contacts --match-first 'c<$domains>' --match-second 'R<ALA>' ...

I will look forward to your help.

Sincerely,
Aurimas

P.S. I tried writing "$domains" but still no success

Last edited by Aurimas; 1 Week Ago at 11:44 AM..
# 2  
The single quotes keep the shell from expanding th variable. Try double quotes instead. If the single quotes are needed, double quote those.
# 3  
What you mean by double quote those?

--- Post updated at 03:48 PM ---

Understood. Double quotes worked Smilie

--- Post updated at 03:53 PM ---

I get the first value when I do "'c<domains>'" or "c<domains>" but as the second should be 152.314, I am not getting anything for it. In general there should be 114 different values. Where might be my problem?

--- Post updated at 04:21 PM ---

Everything works. Had mistaken values.
# 4  
Dear all,

How can I exit the script and return to terminal if domains is not equal to .pdb file, which i specifies . How could I make domains to be equal to "e" or any other string, number, etc. that would mean for the script to exit it and return to terminal?

The upgraded script:
Code:
#!/bin/bash
for i in $( ls ); do
    echo $i
    read -p "Domains: " domains
    cat $i | voronota get-balls-from-atoms-file --annotated | voronota calculate-contacts --annotated | voronota query-contacts --match-first "'c<$domains>'" --match-second 'R<ALA>' | awk '{sum += $3} END {print sum}'
done

I will look forward to your replies.

Sincerely,
Aurimas

--- Post updated at 07:26 PM ---

Solved. No need for help.

Last edited by Aurimas; 6 Days Ago at 03:26 PM..
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Passing variable as input & storing output in other variable
sam@sam
I have a below syntax its working fine... var12=$(ps -ef | grep apache | awk '{print $2,$4}') Im getting expected output as below: printf "%b\n" "${VAR12}" dell 123 dell 456 dell 457 Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results...... UNIX for Advanced & Expert Users
5
UNIX for Advanced & Expert Users
Passing a variable as input to another shell
swayam123
I have a shell program that calls another shell program the following code works . chkTimeFormat.sh "10/9/12 17:51:19:783."|read c but when I am passing the the time in a variable like in the code below, the shell chkTimeFormat.sh is not returning proper value time="10/9/12...... Shell Programming and Scripting
9
Shell Programming and Scripting
Passing variable as an input file to AWK comand
ezhil01
Hi, I would like to compare 2 files using awk, which I can do by using: awk 'NR==FNR{a;next} (NR > 32 && $2 in a) {print $0}' File1 and File2. If the name of the File1 is in another file (for example, column 4 in File 3) then how can I pass this column 4 to the awk command. Thanks in...... Shell Programming and Scripting
1
Shell Programming and Scripting
Shell variable to c++ program as input
shashi792
I have an Shell script which has few global variables eg : range=100; echo "$range" I want to use the same variable in my C++ program for example int main() { cout << range << "\n"; } i tried using this int main(int argc, char *argv) { cout << range << "\n"; } but...... Shell Programming and Scripting
5
Shell Programming and Scripting
Passing struct through unix pipe -solved
twnsfn34
EDIT: Nevermind, called a friend who is good at this stuff and he figured it out :D Hi all, So I'm trying to teach myself to write programs for unix in c. I am currently creating a program, and I need to pass a struct through a pipe, but I can't figure out how. The struct I want to pass...... UNIX for Dummies Questions & Answers
0
UNIX for Dummies Questions & Answers