Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SHELL SCRIPTING Starting with the shell script code above, create a simple 2 x 2 display using 4 unique stock symbols. shell code # #

SHELL SCRIPTING

Starting with the shell script code above, create a simple 2 x 2 display using 4 unique stock symbols.

shell code

# # for loop to process stock list # clear while true do for stock in `cat stocks.txt` do wget -qO- http://finance.yahoo.com/d/quotes.csv?s=$stock\&f=nl1c1v >data1 cat data1 | sed s/", "/" "/g >data2 mv data2 data1 change=`cat data1 | awk -F, '{print $3}'` negative=`echo $change | grep "-" | wc -l` positive=`echo $change | grep "+" | wc -l` if [ $negative -eq 1 ] then # # 1 = red, 0 = black # tput setab 1; tput setaf 0; else if [ $positive -eq 1 ] then # # 2 = green, 0 = black # tput setab 2; tput setaf 0; fi fi tput cup 1 10; echo " " tput cup 1 10; echo " $stock" name=`cat data1 | awk -F, '{printf "%-14.14s", $1}'` tput cup 2 10; echo " " tput cup 2 10; echo "$name" price=`cat data1 | awk -F, '{print $2}'` tput cup 3 10; echo " " tput cup 3 10; echo "$price" change=`cat data1 | awk -F, '{print $3}'` tput cup 4 10; echo " " tput cup 4 10; echo "$change" volume=`cat data1 | awk -F, '{print $4}'` tput cup 5 10; echo " " tput cup 5 10; echo "$volume" sleep 2 done done 

text file (stocks.txt)

MCD AAPL DIS NKE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago