Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ort script which uses a pipe to the wc program so that the variable num.files is set to the number of files in a directory,

image text in transcribed
ort script which uses a pipe to the wc program so that the variable num.files is set to the number of files in a directory, where the directory is given by the user as an argument to the script, and then echos that number when you run it. ) You can do simple addition and subtraction inside a Bash script with, for example, echo S[1+1]. Try it on the command line to see that it works. You can do multiplication and division as well, but only if the answer is an integer. If there is a decimal part in the answer it will be dropped. Try echo $[3/4] and see what you get. In order to do floating point arithmetic you need to download a program called bc (binary calculator). Use apt-get to install the program and then use it in a pipeline like echo 3/4 | bc -1. An example script would be #1 /bin/bash a-$(echo "scale-5 ; echo $a 5/3" | bc -1) You can read the man page for bc and try various inputs and other things to see how it performs. Write a script that calculates(x)sin(e) on the user supplied variable r and prints the result to the screen

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_2

Step: 3

blur-text-image_3

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

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

Students also viewed these Databases questions

Question

LO2 Discuss important legal areas regarding safety and health.

Answered: 1 week ago