KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This should be pretty straightfoward and I don't know why I am struggling with it. I am running the following psql command from within a shell script in order to find out whether all indexes have been dropped before inserting data. INDEXCOUNT=$(psql -p $dbPort -U enterprisedb -d main_db -c "select Count(*) from all_indexes where index_schema = 'enterprisedb';") At this point, INDEXCOUNT is equal to “COUNT ------- 0” Now if I echo the following line I get the result I want - echo $INDEXCOUNT | awk '{print $3}' How do I assign the value of $INDEXCOUNT | awk ‘{print $3}’ to a variable to check it in an “IF” statement? For example: RETURNCOUNT=$INDEXCOUNT | awk '{print $3}'
Tags (comma-separated)
Save Edits
Cancel