This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==== Problem #1 ==== | |
// The dealer can't recall the information for a car with an id of 33 on his lot. Help the dealer find out which car has an id of 33 by calling a function that will return the data for that car. Then log the car's year, make, and model in the console log in the format of: | |
// "Car 33 is a *car year goes here* *car make goes here* *car model goes here*" | |
const inventory = require('./cars.cjs') | |
function getCarWithId(inventoryData,id){ | |
let car =[]; | |
if(inventoryData === undefined || id === undefined || typeof inventoryData !== 'object' ||typeof id !== 'number'||!Array.isArray(inventoryData)||inventoryData.length === 0) { | |
return car; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####### | |
#Pipes# | |
####### | |
#Download the contents of "Harry Potter and the Goblet of fire" using the command line | |
wget https://raw.githubusercontent.com/bobdeng/owlreader/master/ERead/assets/books/Harry%20Potter%20and%20the%20Goblet%20of%20Fire.txt | |
#Print the first three lines in the book | |
#using awk | |
cat "Harry Potter and the Goblet of Fire.txt" | awk 'FNR==1,FNR==3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/bash | |
# Creating_directory_structure | |
mkdir -p hello/{one/two/three/four,five/six/seven} | |
touch hello/five/six/c.txt hello/five/six/seven/error.log hello/five/six/seven/error.log hello/one/{a.txt,b.txt} hello/one/two/d.txt hello/one/two/three/e.txt hello/one/two/three/four/access.log | |
# Delete all the files having the .log extension | |
find . -name '*.log' -delete | |
echo Deleting file with the .log extension |