Part 2. Simple pipeline (5 points)
For several subsequent parts of this lab, you’re going to need to run the scripts you write on a large code base. We’re going to use the source code for the Linux kernel. You’re going to write a one-line shell script that downloads and decompresses the source code.
Your task
Write a one-line script that uses curl to download the compressed Linux
source code and pipes it to tar which extracts the source code into the
current directory. The Linux source code is available at this URL.
https://github.com/torvalds/linux/archive/refs/tags/v6.4.tar.gz
Your command should be structured as follows.
$ curl ARGS | tar ARGS
After you run the command, you should have a new directory named linux-6.4
which contains the source code to version 6.4 of Linux. Do not commit the
Linux source code to your assignment repository.
Write the pipeline command you come up with in a file named README.
Normally, a README provides information about a project. GitHub will display
the contents of your README when you visit the web page for your repository
(after you have pushed the README to GitHub). You’ll use this same file
several times to record the commands you come up with.
- If you run
curl https://github.com/torvalds/linux/archive/refs/tags/v6.4.tar.gzwith no other options, no output is printed. That’s because GitHub, like many websites, will redirect the browser to different URLs. The way this works technically is to use a redirection HTTP status with aLocationheader. Search thecurlman page to figure out which option to use to getcurlto follow the redirection specified in theLocationheader. - The
tarcommand, like many (but sadly not all) command-line utilities that operate on files, will accept a single-as the name of the file to mean read fromstdinrather than reading from the file (and for output, write tostdoutrather than writing to a file). - Notice that the source code is in an archive with the file extension
.gz. This means that the code was archived using the gzip software. You should find ataroption that works with gzip archives.