-
Suppose we have a file
directories.txtwhere each line contains the name of a directory that we want to create. Our friend proposes that we runcat directories.txt | mkdirinto order to do this? Will this command work? If not, how can we change this command to get it to work/could we improve it in any way? -
Come up with a general statement about when we need to use the
xargscommand. -
Suppose we have the
intro_survey.csvfrom the previous homework assignment. Usingcut, how many unique answers were there to the question “What’s your favorite candy”? -
Suppose we have the intro survey data below. Let’s try to print the column “Cats or Dogs?” from this data. First, come up with a
cutcommand you might use to do this. Second, predict whether or not this will work for the data below. Third, run thecutcommand on the data below. Did it work? Why or why not?
What's your favorite candy?,What's your favorite dinner?,Cats or Dogs?,Are you currently enrolled in CSE 351?
Peanut M&Ms,Sandwich,Either,No
Snickers,rice, pork, and cabbage,Dogs,No
Sour skittles,thai,Dogs,No
sour patch, starburst,Dumplings,Cats,No
-
Write a command that lists all the
importstatements in any*.javafiles within the current directory and its subdirectories. For this problem, you can assume that animportstatement just has the word “import” in it. Bonus points: also show the line number! -
Write a command that would delete all directories, recursively, starting from the current directory. Be careful about where you run this command!! Don’t run it from your home directory!
-
Suppose we were given a zip file called
files.zip. Come up with a one-line shell statement that unzips all of its contents and then compiles all of the*.javafiles inside of it. -
Suppose we know that
Compile.javacompiles with no errors. If we were to runjavac Compile.java || java Compilewhat would be the result? Would the program compile? Would it run? -
What would be some security issues with running some of the commands you learned from lecture (think of some of the practical implications of
rm,find, andxargsin regards to malicious code injection)?